You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been working with the Java TWS API for some time, just upgraded to the most recent version and see that the EReader and signal part is new. I like how you wrapped it in spring boot. I see your Order Management service, is there a way to provide callback object that can get updates and event notification like rejected or filled, or would you hook into the EWrapper. In the framework I wrote, my EWrapper instance just delegates method calls to registered listeners that also implement a EWrapper like interface except making all the methods default so you can pick the methods to override. As far as submitting LIMIT buy orders where the limit price will increment as the target price does so you "chase the price" do you know if that is possible. There is something called LimitOffset not sure if that is what I'm looking for.
Also in my case, I've built a pretty massive computing cluster that is generic to time series data which it uses to derive data sets from incoming quotes, like moving averages and volume traded in last x seconds or rate of change between two sets of moving averages and then every day it aggregates the high/low of these values for each stock so I can build queries for signals that can compare the current value of a variable to its aggregated highest over the last x number of days, adding multiple criterias for a signal lets me detect multiday breakouts across several thousands stocks. I was not able to use IB as a stable feed also subsribe to Active Tick, the automated trading extension using this API is built on the concept of a trade play, where a trade play selects a signal as an entry trigger, capital to allocate, entry strategy like limit or market and timeout, and then multiple trigger types that can be added to trigger a trade exit like a trailing stop, or a signal that defines reversal in momentum, or an unrealized PL. All this has to tie into the TWS APiI, and I abstracted it on the level of trades where each trade has an entry and exit strategy api for entry its based on what types of orders to submit and how long to try filling the order and then exit strategy is those triggers. I built a cool UI around it https://dunkstreet.com -> one thing about TWS is the annoyance of restarts, I've had to add wrapper code around brokers in my system that change state when it goes offline but overall a pretty cool project. Like your thinking on making the API easier to use and integration with spring boot. Anyway good suff, sending on some kudos.
The Computing of all the derived data from incoming quotes happens in a kubernetes cluster where I take the high volume data feed and split it across multiple worker nodes that consume a subset of stock data, this is the dashboard.
And the way I derive or build a better set of incoming data to consume an analyze is through a DSL that looks like this.
A way to think of it is like a column based spreadsheet where new columns are added that have formulas applied on the columns using other columns as inputs and referenced columns can include historical data ranges or current values so you end up with a bunch of data like number of trades in the last 30 seconds, percent change of the 1 x 2 minute moving average and then every day like I mentioned the high and low for each variable on each stock are computed and stored, here is a screen of the high of highs and the low of lows on First Solar.
Whats cool if you look at the variables SmaRoc1x2min and SmaRoc2x3min which are the highs of rate of changes between the 1 x 2 minute moving average and the 2 x 3 minute moving average over the last 40+ days (everyday it runs I get another day to look back) you can see the date/time stamps lining up with the chart here.
And to generate the signals, I have a pretty cool query engine around all of this that works on abstract values that can be compared in an expression where a value can be the current value of a variable or the highest value in the last 30+ days, then apply a function to compare like difference or percent change with an operator and value to define a criteria, so I add multiple criteria's that compare the current value of these moving average rate of changes and volume to the past and trigger signals based on that.
This is the way I define the highest value of the SmaRoc1x2 min in the last 40 days as a value
Then to define the current value of the SmaRoc1x2 min it looks like this
As you go through the stepper you define a value compare function and an operator like > 5 so that when the rate of change between the 1 x 2 minute moving averages is 5% greater than any value in the last 40 days that shows how signals can be defined, a query is composed of many criteria and the truth point is to find out what happens when I build an automated trading system that can connect to brokers like TWS (abstracted a broker interface) and let it run and selectively trade when 1 of several thousand stocks has a major breakout.
Then I can add multiple Brokerage accounts, the pain here is event handling around EWrapper and updating a broker status when a connection drops and then have a loop that attempts interval reconnections, lastly the trade play that puts it all together and is applied on the an account level references a signal with trading specific logic like allocated capital, trade throttling on a symbol and automated entry and exit logic.
I'm close!!! - Using spring boot micro services through a spring boot gateway server, the computing is solid the automated trading is kind of tough, which got me looking at your abstraction of the underlying API, the other challenge is having solid event handling in the trading engine, i did that by creating an annotated based event notification system so an account can get notified on all downstream things like a trade play which then has a trade which then has orders, and through this event chain is how the automated trading works. Why I just decided to explain all this to you I'm not exactly sure LOL. Nice project, like your thinking on abstraction of the TWS API, I did a bit different, not much of an abstraction but having a registry of EWrapper method handlers that can be added and removed so for example, when a trade bot submits an order, it attaches itself as a EWrapper, selects the methods it wants to override and then updates the order on the bot as order updates are sent and ultimately filled. the order can then dispatch an event that its filled and goes through the upstream event notification chain, and a bot when it makes a trade has an entry which opens orders and once completed it notifies upstream and bot then starts the exit strategy which has the exit triggers I talked about. Truth is what I am after, can't wait to see when I can finally complete the linking of automated trading to the core engine described.
Happy to contribute to your project, not sure if it aligns with the direction I have gone but its cool how you have exposed some spring boot end points into the TWS API, i recently figured out Webflix pretty well and figure out how to create streaming data over REST which is cool. I plan to open source that part soon, it uses something called Glazed Lists which can be wrapped by a change stream like row updates or inserts and goes into a reusable react component. - Take Care - Duncan
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have been working with the Java TWS API for some time, just upgraded to the most recent version and see that the EReader and signal part is new. I like how you wrapped it in spring boot. I see your Order Management service, is there a way to provide callback object that can get updates and event notification like rejected or filled, or would you hook into the EWrapper. In the framework I wrote, my EWrapper instance just delegates method calls to registered listeners that also implement a EWrapper like interface except making all the methods default so you can pick the methods to override. As far as submitting LIMIT buy orders where the limit price will increment as the target price does so you "chase the price" do you know if that is possible. There is something called LimitOffset not sure if that is what I'm looking for.
Also in my case, I've built a pretty massive computing cluster that is generic to time series data which it uses to derive data sets from incoming quotes, like moving averages and volume traded in last x seconds or rate of change between two sets of moving averages and then every day it aggregates the high/low of these values for each stock so I can build queries for signals that can compare the current value of a variable to its aggregated highest over the last x number of days, adding multiple criterias for a signal lets me detect multiday breakouts across several thousands stocks. I was not able to use IB as a stable feed also subsribe to Active Tick, the automated trading extension using this API is built on the concept of a trade play, where a trade play selects a signal as an entry trigger, capital to allocate, entry strategy like limit or market and timeout, and then multiple trigger types that can be added to trigger a trade exit like a trailing stop, or a signal that defines reversal in momentum, or an unrealized PL. All this has to tie into the TWS APiI, and I abstracted it on the level of trades where each trade has an entry and exit strategy api for entry its based on what types of orders to submit and how long to try filling the order and then exit strategy is those triggers. I built a cool UI around it https://dunkstreet.com -> one thing about TWS is the annoyance of restarts, I've had to add wrapper code around brokers in my system that change state when it goes offline but overall a pretty cool project. Like your thinking on making the API easier to use and integration with spring boot. Anyway good suff, sending on some kudos.
The Computing of all the derived data from incoming quotes happens in a kubernetes cluster where I take the high volume data feed and split it across multiple worker nodes that consume a subset of stock data, this is the dashboard.
So I view it in terms of entities, because its a generic computing engine based on a patent I developed.
https://patents.google.com/patent/US11457052B1/en?assignee=dunkware&oq=dunkware
And the way I derive or build a better set of incoming data to consume an analyze is through a DSL that looks like this.
A way to think of it is like a column based spreadsheet where new columns are added that have formulas applied on the columns using other columns as inputs and referenced columns can include historical data ranges or current values so you end up with a bunch of data like number of trades in the last 30 seconds, percent change of the 1 x 2 minute moving average and then every day like I mentioned the high and low for each variable on each stock are computed and stored, here is a screen of the high of highs and the low of lows on First Solar.
Whats cool if you look at the variables SmaRoc1x2min and SmaRoc2x3min which are the highs of rate of changes between the 1 x 2 minute moving average and the 2 x 3 minute moving average over the last 40+ days (everyday it runs I get another day to look back) you can see the date/time stamps lining up with the chart here.
And to generate the signals, I have a pretty cool query engine around all of this that works on abstract values that can be compared in an expression where a value can be the current value of a variable or the highest value in the last 30+ days, then apply a function to compare like difference or percent change with an operator and value to define a criteria, so I add multiple criteria's that compare the current value of these moving average rate of changes and volume to the past and trigger signals based on that.
This is the way I define the highest value of the SmaRoc1x2 min in the last 40 days as a value
Then to define the current value of the SmaRoc1x2 min it looks like this
As you go through the stepper you define a value compare function and an operator like > 5 so that when the rate of change between the 1 x 2 minute moving averages is 5% greater than any value in the last 40 days that shows how signals can be defined, a query is composed of many criteria and the truth point is to find out what happens when I build an automated trading system that can connect to brokers like TWS (abstracted a broker interface) and let it run and selectively trade when 1 of several thousand stocks has a major breakout.
Then I can add multiple Brokerage accounts, the pain here is event handling around EWrapper and updating a broker status when a connection drops and then have a loop that attempts interval reconnections, lastly the trade play that puts it all together and is applied on the an account level references a signal with trading specific logic like allocated capital, trade throttling on a symbol and automated entry and exit logic.
I'm close!!! - Using spring boot micro services through a spring boot gateway server, the computing is solid the automated trading is kind of tough, which got me looking at your abstraction of the underlying API, the other challenge is having solid event handling in the trading engine, i did that by creating an annotated based event notification system so an account can get notified on all downstream things like a trade play which then has a trade which then has orders, and through this event chain is how the automated trading works. Why I just decided to explain all this to you I'm not exactly sure LOL. Nice project, like your thinking on abstraction of the TWS API, I did a bit different, not much of an abstraction but having a registry of EWrapper method handlers that can be added and removed so for example, when a trade bot submits an order, it attaches itself as a EWrapper, selects the methods it wants to override and then updates the order on the bot as order updates are sent and ultimately filled. the order can then dispatch an event that its filled and goes through the upstream event notification chain, and a bot when it makes a trade has an entry which opens orders and once completed it notifies upstream and bot then starts the exit strategy which has the exit triggers I talked about. Truth is what I am after, can't wait to see when I can finally complete the linking of automated trading to the core engine described.
Happy to contribute to your project, not sure if it aligns with the direction I have gone but its cool how you have exposed some spring boot end points into the TWS API, i recently figured out Webflix pretty well and figure out how to create streaming data over REST which is cool. I plan to open source that part soon, it uses something called Glazed Lists which can be wrapped by a change stream like row updates or inserts and goes into a reusable react component. - Take Care - Duncan
Beta Was this translation helpful? Give feedback.
All reactions