コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
ファイル: StopOrders.cs プロジェクト: Lucitiel/QuikSharp
        /// <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);
        }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
 /// <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;
 }
コード例 #8
0
ファイル: QuikService.cs プロジェクト: iiAlladin/QUIKSharp
        /// <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);
            }
        }
コード例 #9
0
 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);
     }
 }
コード例 #10
0
 /// <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);
     }
 }
コード例 #11
0
ファイル: Quik.cs プロジェクト: shchekoldin/QuikSharp
 /// <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);
 }
コード例 #12
0
 /// <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;
 }
コード例 #13
0
 public TradingFunctions(int port)
 {
     QuikService = QuikService.Create(port);
 }
コード例 #14
0
 public CandleFunctions(int port)
 {
     QuikService = QuikService.Create(port);
 }
コード例 #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="port"></param>
 public OrderBookFunctions(int port)
 {
     QuikService = QuikService.Create(port);
 }
コード例 #16
0
ファイル: OrderBookFunctions.cs プロジェクト: spvik/QuikSharp
 /// <summary>
 ///
 /// </summary>
 /// <param name="port"></param>
 /// <param name="host"></param>
 public OrderBookFunctions(int port, string host)
 {
     QuikService = QuikService.Create(port, host);
 }
コード例 #17
0
 public static void StartServices()
 {
     quikService = QuikService.Create(Quik.DefaultPort);
 }
コード例 #18
0
 // Если запуск "сервиса" (потоков работы с Lua) происходит в конструкторе Quik, то возможности остановить "сервис" нет.
 // QuikService объявлен как private.
 public void StopService()
 {
     QuikService.Stop();
 }
コード例 #19
0
 public ClassFunctions(int port)
 {
     QuikService = QuikService.Create(port);
 }
コード例 #20
0
ファイル: TradingFunctions.cs プロジェクト: kotenev/QUIKSharp
 public TradingFunctions(int port, string host)
 {
     QuikService = QuikService.Create(port, host);
 }
コード例 #21
0
ファイル: CandleFunctions.cs プロジェクト: ipARTEM/QUIKSharp
 public CandleFunctions(int port, string host)
 {
     QuikService = QuikService.Create(port, host);
 }
コード例 #22
0
 public bool IsServiceConnected()
 {
     return(QuikService.IsServiceConnected());
 }
コード例 #23
0
 public StopOrderFunctions(int port, Quik quik, string host)
 {
     QuikService = QuikService.Create(port, host);
     Quik        = quik;
 }
コード例 #24
0
 public QuikEvents(QuikService service)
 {
     QuikService = service;
 }
コード例 #25
0
 public static void StartServices()
 {
     quikService = QuikService.Create(Quik.DefaultPort);
     Task.Run(() => Tray.Run());
 }
コード例 #26
0
 public MessageConverter(QuikService service)
 {
     _service = service;
 }
コード例 #27
0
 public DebugFunctions(int port)
 {
     QuikService = QuikService.Create(port);
 }
コード例 #28
0
        internal static IMessage FromJson(this string json, QuikService service)
        {
            var obj = JsonConvert.DeserializeObject <IMessage>(json, new MessageConverter(service));

            return(obj);
        }
コード例 #29
0
 public StopOrderFunctions(int port, Quik quik)
 {
     QuikService = QuikService.Create(port);
     Quik        = quik;
 }