| SmartQuant Discussion http://www.smartquant.com/forums/ |
|
| IB AlgoStrategy http://www.smartquant.com/forums/viewtopic.php?f=41&t=14929 |
Page 1 of 1 |
| Author: | skuvv [ Fri Aug 09, 2019 4:28 pm ] |
| Post subject: | IB AlgoStrategy |
Hi, we have updated IB provider to allow setup custom fields of AlgoStrategy. Release 1.0.7160. Old code obsolete, because IB constantly changing their API for algos. Reference API: https://interactivebrokers.github.io/tws-api/ibalgos.html Example usage in strategy: Code: using System; using System.Collections.Generic; using SmartQuant.IB.Messages; using SmartQuant; namespace OpenQuant { //see IB docs for details: //https://interactivebrokers.github.io/tws-api/ibalgos.html public class IBAlgos : InstrumentStrategy { Order order_vwap; Order order_adaptive; public IBAlgos(Framework framework, string name) : base(framework, name) { } protected override void OnBar(Instrument instrument, Bar bar) { // if (order_adaptive == null) { order_adaptive = BuyOrder(instrument, 400, "IB-Adaptive"); List<TagValue> values = new List<TagValue>(); order_adaptive[SmartQuant.EFIXField.IBalgoStrategy] = "Adaptive"; order_adaptive[SmartQuant.EFIXField.IBalgoParams] = values; values.Add(new TagValue() { Tag = "adaptivePriority", Value = "Normal" }); Send(order_adaptive); return; } // if (order_vwap == null) { order_vwap = BuyOrder(instrument, 400, "IB-Vwap"); List<TagValue> values = new List<TagValue>(); order_vwap[SmartQuant.EFIXField.IBalgoStrategy] = "Vwap"; order_vwap[SmartQuant.EFIXField.IBalgoParams] = values; values.Add(new TagValue() { Tag = "maxPctVol", Value = "0.1" }); values.Add(new TagValue() { Tag = "startTime", Value = "09:00:00 CET" }); values.Add(new TagValue() { Tag = "endTime", Value = "16:00:00 CET" }); values.Add(new TagValue() { Tag = "allowPastEndTime", Value = "1" }); values.Add(new TagValue() { Tag = "noTakeLiq", Value = "1" }); values.Add(new TagValue() { Tag = "speedUp", Value = "1" }); values.Add(new TagValue() { Tag = "monetaryValue", Value = "100000" }); Send(order_vwap); return; } } } } As you can see, there are two required fields in algo order: Code: SmartQuant.EFIXField.IBalgoStrategy SmartQuant.EFIXField.IBalgoParams TagValue is placed in SmartQuant.IB.dll, therefore it requires a direct reference in strategy project: Attachment: ibalgo.png [ 9.51 KiB | Viewed 125722 times ] |
|
| Page 1 of 1 | All times are UTC + 3 hours |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|