- ago
Hello,
I want to use trading signals generated by external python machine learning code.
If you have any sample code on how to use an external trading signal, please let me know.

I want to use the external signals for both back-testing and live trading.
0
932
Solved
9 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.62% )
- ago
#1
Do you mean in a backtesting context? Or for live trading?
0
- ago
#2
I've made ML API (Python) that gets model name and data. This API runs all models, and returns predict for the model and data.

In WL7, in turn, I've added some methods to make POST calls to this API and to pack data for such calls.
0
- ago
#3
You can simply read it back from a file and let your strategy place signals.
0
Cone8
 ( 4.98% )
- ago
#4
QUOTE:
If you have any sample code on how to use an external trading signal, please let me know.... I want to use the external signals for both back-testing and live trading.
I can whip something up. What would the data records look like?

You'd need something like the following, but what would the date part represent if live trading? The signal bar time? It needs to be synchronized to something.

20211008T09:30:00 Buy AMD 100 Limit at 95.55
0
- ago
#5
QUOTE:
.. simply read [signals] back from a file and let your strategy place signals.
The term "file" should be interpreted loosely. This could also mean the Windows clipboard. That's typically what's used to "generically" exchange data between applications. And it might even be easier (certainly faster) to do than using a real disk file.

There are many other approaches such as sockets (what the IQFeed client uses) or application procedure calls (COM), but they are more involved. I would get the simple clipboard approach debugged first before attempting advanced OS methods.
0
Cone8
 ( 4.98% )
- ago
#6
To me, "file" means disk file. It's a hard record to look at if something unexpected happens. Reading a few hundred records from a file *once* for a strategy run probably takes about the same amount time as it takes you to release the mouse after clicking. If someone wants to do something more specialized to save a msec and not have a hard record, I won't stop you.
0
- ago
#7
Is there an interface API provided by WL7 to use external trading signal ?
0
Glitch8
 ( 10.62% )
- ago
#8
Do you mean in a backtesting context? Or for live trading?
0
- ago
#9
QUOTE:
... an interface API provided ... to use external trading signal?
You have all the I/O methods provided by the Microsoft .NET framework you can use. And that's just about everything: file I/O, clipboard I/O, sockets, COM/DCOM, shared memory, message passing. But these are .NET framework procedures that tie into the OS. Remember, the OS is in control when it comes to communicating between different applications, which I think is what you want to do. Right?

There are some external libraries say for distributed processing (ISIS comes to mind). But for a single-computer, single-processor problem, I think the .NET framework provides all you need. And that's built into Windows and the applications (like WL) that support it.

I would cite the Microsoft docs, but unless you're a .NET programmer, they are a bit overwhelming. I would checkout a good C#/.NET introductory book first for I/O methods. And it would give you a good overview of all the options I listed above.

I think doing something with file or clipboard I/O would be easiest to setup. The more advanced approaches (COM) allow more synchronization between applications, but they are somewhat more involved to setup and debug.

Here's an overly simple example of reading a string from the Clipboard. https://stackoverflow.com/questions/35867427/read-text-from-clipboard In practice, I would read it in with a StringReader datatype (instead of "string") because that will let me read and parse one line at a time into a C# object, which is convenient.
1
Best Answer

Reply

Bookmark

Sort