- ago
We are implementing BrokerAdapter for MOEX.

There is a method public virtual int GetSymbolDecimals(string symbol, double price)

But what if a ticker has a price step like 0.0025 or 0.02 . Orders with (price % step != 0) will be rejected. We can return 3 by GetSymbolDecimals for 0.0025 step and 1 for 0.02 step. Is there any more flexible way to solve this?
0
729
4 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.34% )
- ago
#1
Ideally this would be under the control of "Markets and Symbols" tool, the "Symbols" tab, and the "TickSize" property. The backtester is already adjusting prices for TickSize if you've enabled futures mode in Backtest Settings, but I do not believe TickSize is considered for manual trades. I'm feeling it should perhaps not be dependent on Futures Mode either, we'll create an issue and work on an overall solution. Any ideas, post them here.
0
Glitch8
 ( 12.34% )
- ago
#2
Until we can come up with a more integrated approach. your custom broker provider could look to see if there is a SymbolInfo defined for the symbol and adjust the price ...

CODE:
SymbolInfo si = MarketManager.FindSymbol(symbol); if (si != null) { int truncated = (int)(price / si.TickSize); price = truncated * si.TickSize; }
0
- ago
#3
Thanks.

Yes, as I see it:

- BrokerAdapter (on its initialization) updates steps values for the tickers list. New values can be seen at “Markets and Symbols”.
- The execution (WL7) that uses GetSymbolDecimals searches for the ticker in “Markets and Symbols” if there is a value for the ticker – it has higher priority then symbolDecimal value. If there is no one – symbolDecimal value is used.

Or:

- BrokerAdapter has an oprional method to be overridden: GetSymbolStep(), and execution tries this method. If it’s overridden – it gets data from it, if it’s not – from GetSymbolDecimal.

And yes, why do only futures deserve price steps?)
0
Cone8
 ( 6.61% )
- ago
#4
This old thread caught my eye in my bookmarks.

Here's the way we solved if for the IB Provider:
https://www.wealth-lab.com/Discussion/Round-to-minimum-tick-of-a-European-stock-10855

Essentially, the broker provider gets the price step information and applies it to the stop/limit price before sending the order .
0

Reply

Bookmark

Sort