bug-or-feature / pysystemtrade-fsb

Systematic spread betting in Python
https://pysystemtrade-fsb.bugorfeature.net/
GNU General Public License v3.0
10 stars 2 forks source link

Potential improvements to spread sampler #29

Closed bug-or-feature closed 1 year ago

bug-or-feature commented 1 year ago

There may be scope to improve the spread sampler. Currently we iterate over all the instruments, subscribing to the IG streaming API individually for that instrument for a max of 10 seconds. If there are enough price hits within those 10 seconds we create a sample record. Instead we could subscribe to 40 (the max) instruments at once, and sample for longer. And perhaps more often. The total instrument count is more than 40, so we'd have to rotate the instruments. And we can now be smarter about which instruments to sample, as we have the trading hours. Presumably the prices will be more active when the underlying is open and active, so we could factor that in

bug-or-feature commented 1 year ago

The current setup also isn't good for bets where the price doesn't change very often - eg EURIBOR-ICE. May need a plan B, like using the historic price service for certain instruments

bug-or-feature commented 1 year ago

This is no longer needed, spread sampling now more closely follows how it is done upstream. There's a new trading-ig Ticker object that gets automatically updated in the background, we just take 200 ticks or 5 seconds, whichever happens first. Currently it relies on a feature branch of trading-ig