/// <summary> /// Возвращает заявку по номеру. /// </summary> public async Task <Order> GetOrder_by_Number(long order_num) { var message = new Message <string>(order_num.ToString(), "getOrder_by_Number"); Message <Order> response = await QuikService.Send <Message <Order> >(message).ConfigureAwait(false); return(response.Data); }
/// <summary> /// Возвращает заявку из хранилища терминала по её номеру. /// На основе: http://help.qlua.org/ch4_5_1_1.htm /// </summary> /// <param name="classCode">Класс инструмента.</param> /// <param name="orderId">Номер заявки.</param> /// <returns></returns> public async Task <Order> GetOrder(string classCode, long orderId) { var message = new Message <string>(classCode + "|" + orderId, "get_order_by_number"); Message <Order> response = await QuikService.Send <Message <Order> >(message).ConfigureAwait(false); return(response.Data); }
/// <summary> /// Возвращает список всех стоп-заявок. /// </summary> /// <returns></returns> public async Task <List <StopOrder> > GetStopOrders() { var message = new Message <string>("", "get_stop_orders"); Message <List <StopOrder> > response = await QuikService.Send <Message <List <StopOrder> > >(message).ConfigureAwait(false); return(response.Data); }
/// <summary> /// Возвращает заявку для заданного инструмента по ID. /// </summary> public async Task <Order> GetOrder_by_transID(string classCode, string securityCode, long trans_id) { var message = new Message <string>(classCode + "|" + securityCode + "|" + trans_id, "getOrder_by_ID"); Message <Order> response = await QuikService.Send <Message <Order> >(message).ConfigureAwait(false); return(response.Data); }
/// <summary> /// Возвращает список всех стоп-заявок. /// </summary> /// <returns></returns> public async Task <List <StopOrder> > GetStopOrders() { var message = new Message <string>("", "GetStopOrders"); Message <List <StopOrder> > response = await QuikService.Send <Message <List <StopOrder> > >(message); return(response.Data); }
/// <summary> /// Возвращает список стоп-заявок для заданного инструмента. /// </summary> public async Task <List <StopOrder> > GetStopOrders(string classCode, string securityCode) { var message = new Message <string>(classCode + "|" + securityCode, "get_stop_orders"); Message <List <StopOrder> > response = await QuikService.Send <Message <List <StopOrder> > >(message).ConfigureAwait(false); return(response.Data); }
/// <summary> /// Quik interface in .NET constructor /// </summary> public Quik(int port = DefaultPort, IPersistentStorage storage = null) { if (storage == null) { Storage = new InMemoryStorage(); } else { Storage = storage; } QuikService = QuikService.Create(port); // poor man's DI QuikService.Storage = Storage; Events = QuikService.Events; Debug = new DebugFunctions(port); Service = new ServiceFunctions(port); Class = new ClassFunctions(port); OrderBook = new OrderBookFunctions(port); Trading = new TradingFunctions(port); StopOrders = new StopOrderFunctions(port, this); Orders = new OrderFunctions(port, this); Candles = new CandleFunctions(port); QuikService.Candles = Candles; QuikService.StopOrders = StopOrders; QuikService.WorkingFolder = Service.GetWorkingFolder().Result; }
/// <summary> /// For each port only one instance of QuikService /// </summary> public static QuikService Create(int port, string host) { lock (StaticSync) { QuikService service; if (Services.ContainsKey(port)) { service = Services[port]; service.Start(); } else { service = new QuikService(port, host); Services.Add(port, service); } service.Serializer = new JsonSerializer { TypeNameHandling = TypeNameHandling.None, NullValueHandling = NullValueHandling.Ignore }; service.Serializer.Converters.Add(new MessageConverter(service)); return(service); } }
internal static IMessage FromJson(this string json, QuikService service) { using (var reader = new JsonTextReader(new StringReader(json))) { // reader will get buffer from array pool reader.ArrayPool = JsonArrayPool.Instance; var value = service.Serializer.Deserialize <IMessage>(reader); return(value); } }
/// <summary> /// For each port only one instance of QuikService /// </summary> public static QuikService Create(int port) { lock (StaticSync) { QuikService service; if (_services.ContainsKey(port)) { service = _services[port]; service.Start(); } else { service = new QuikService(port); _services.Add(port, service); } return(service); } }
/// <summary> /// Quik interface in .NET constructor /// </summary> public Quik(int port = DefaultPort, IPersistentStorage storage = null) { if (storage == null) { Storage = new EsentStorage(); } else { Storage = storage; } QuikService = QuikService.Create(port); // poor man's DI QuikService.Storage = Storage; Events = QuikService.Events; Debug = new DebugFunctions(port); Service = new ServiceFunctions(port); Class = new ClassFunctions(port); OrderBook = new OrderBookFunctions(port); Trading = new TradingFunctions(port); }
/// <summary> /// Quik interface in .NET constructor /// </summary> public Quik(int port = DefaultPort, IPersistentStorage storage = null, string host = DefaultHost) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Storage = storage == null ? new InMemoryStorage() : storage; QuikService = QuikService.Create(port, host); // poor man's DI QuikService.Storage = Storage; Events = QuikService.Events; Debug = new DebugFunctions(port, host); Service = new ServiceFunctions(port, host); Class = new ClassFunctions(port, host); OrderBook = new OrderBookFunctions(port, host); Trading = new TradingFunctions(port, host); StopOrders = new StopOrderFunctions(port, this, host); Orders = new OrderFunctions(port, this, host); Candles = new CandleFunctions(port, host); QuikService.Candles = Candles; QuikService.StopOrders = StopOrders; QuikService.WorkingFolder = Service.GetWorkingFolder().Result; }
public TradingFunctions(int port) { QuikService = QuikService.Create(port); }
public CandleFunctions(int port) { QuikService = QuikService.Create(port); }
/// <summary> /// /// </summary> /// <param name="port"></param> public OrderBookFunctions(int port) { QuikService = QuikService.Create(port); }
/// <summary> /// /// </summary> /// <param name="port"></param> /// <param name="host"></param> public OrderBookFunctions(int port, string host) { QuikService = QuikService.Create(port, host); }
public static void StartServices() { quikService = QuikService.Create(Quik.DefaultPort); }
// Если запуск "сервиса" (потоков работы с Lua) происходит в конструкторе Quik, то возможности остановить "сервис" нет. // QuikService объявлен как private. public void StopService() { QuikService.Stop(); }
public ClassFunctions(int port) { QuikService = QuikService.Create(port); }
public TradingFunctions(int port, string host) { QuikService = QuikService.Create(port, host); }
public CandleFunctions(int port, string host) { QuikService = QuikService.Create(port, host); }
public bool IsServiceConnected() { return(QuikService.IsServiceConnected()); }
public StopOrderFunctions(int port, Quik quik, string host) { QuikService = QuikService.Create(port, host); Quik = quik; }
public QuikEvents(QuikService service) { QuikService = service; }
public static void StartServices() { quikService = QuikService.Create(Quik.DefaultPort); Task.Run(() => Tray.Run()); }
public MessageConverter(QuikService service) { _service = service; }
public DebugFunctions(int port) { QuikService = QuikService.Create(port); }
internal static IMessage FromJson(this string json, QuikService service) { var obj = JsonConvert.DeserializeObject <IMessage>(json, new MessageConverter(service)); return(obj); }
public StopOrderFunctions(int port, Quik quik) { QuikService = QuikService.Create(port); Quik = quik; }