public ServiceResult <QuoteBasicBase> Download(string symbol, int interval, int limit = 300) { var r = ServiceResult <QuoteBasicBase> .CallAsyncFunction(() => _market.Download(symbol, interval, limit)).Result; return(r); //if (r.Result) // return new ServiceResult<QuoteBasicBase> { Result = true, Data = new QuoteBasicBase(r.Data) }; //return new ServiceResult<QuoteBasicBase> { Result = false, Data = null }; }
//public ServiceResult<bool> UpdateLastTimeForOrder(FZOrder order) //{ // return ServiceResult<bool>.CallAsyncFunction(() => _apiOrder.UpdateLastTimeForOrder(order)).Result; //} public ServiceResult <long> GetLastTimeForOrder(string orderId, string symbol) { try { return(ServiceResult <long> .CallAsyncFunction(() => _apiOrder.GetLastTimeForClosedOrder(orderId, symbol)).Result); } catch (Exception e) { return(new ServiceResult <long> { Result = false, Message = e.ToString() }); } }
public ServiceResult <FZOrder> CheckOrder(string symbol, string orderId, bool isStopOrder = false) { try { //var order = new FZOrder { Exchange = _apiOrder.Exchange, Symbol = symbol, OrderId = orderId }; return(ServiceResult <FZOrder> .CallAsyncFunction(() => _apiOrder.CheckOrder(symbol, orderId, isStopOrder)).Result); } catch (Exception e) { return(new ServiceResult <FZOrder> { Result = false, Message = e.ToString() }); } }
public ServiceResult <QuoteBasicBase> GetInMemoryQuoteBasic(string symbol, int interval) { var r = ServiceResult <QuoteBasicBase> .CallAsyncFunction(() => Task.Run(() => _qbStore.GetQuoteBasic(symbol, interval))).Result; return(r); }
//public void ProcessCandleListQueue() //{ // lock (this) // { // if (_isProcessCandleListOngoing) return; // _isProcessCandleListOngoing = true; // } // Task.Run(() => // { // try // { // string symbol; // while (_symbolToUpdate.TryDequeue(out symbol)) // { // var d = _candles[symbol]; // if (_symbolsInitialized.Contains(symbol)) // _qbStore.AddCandle(d.Symbol, d.Interval, d.Time, d.Open, d.Close, d.High, d.Low, d.Volume, true); // else // { // if (_isFillGap) // this.InitQuoteBasic(symbol); // else // this.InitQuoteBasic2(symbol); // } // } // } // catch (Exception ex) // { // OnExceptionOccured?.Invoke(this, Exchange, ex); // } // finally // { // _isProcessCandleListOngoing = false; // } // }); //} //private void ProcessTickerListQueue() //{ // lock (this) // { // if (_isProcessTickerListOngoing) return; // _isProcessTickerListOngoing = true; // } // try // { // List<Ticker> ticker; // while (_tickerQueue.TryDequeue(out ticker)) // { // foreach (var t in ticker) // _tickStore.AddTickers(this.Exchange, t); // } // } // catch (Exception ex) // { // OnExceptionOccured?.Invoke(this, this.Exchange, ex); // } // finally // { // _isProcessTickerListOngoing = false; // } //} //private void ProcessSaveQuoteBasicQueue() //{ // lock (this) // { // if (_isSaveQuoteBasicOngoing) return; // _isSaveQuoteBasicOngoing = true; // } // Task.Run(() => // { // try // { // string quoteId; // while (_quoteIdToSave.TryDequeue(out quoteId)) // { // //Console.WriteLine($"saving {quoteId}..."); // _fileStore.Save(_qbStore.Quotes[quoteId]); // } // } // catch (Exception ex) // { // Console.WriteLine(ex.ToString()); // OnExceptionOccured?.Invoke(this, this.Exchange, ex); // } // finally // { // _isSaveQuoteBasicOngoing = false; // } // }); //} public ServiceResult <QuoteCapture> GetInMemoryQuoteCapture(string symbol) { return(ServiceResult <QuoteCapture> .CallAsyncFunction(() => Task.Run(() => (QuoteCapture)_qcStore.GetInMemoryQuoteCapture(symbol))).Result); }
public ServiceResult <List <FZOrder> > GetOpenOrdersBySymbol(string instrument_id) { return(ServiceResult <List <FZOrder> > .CallAsyncFunction(() => _apiOrder.GetOpenOrdersBySymbol(instrument_id)).Result); }
public ServiceResult <List <FZOrder> > GetClosedOrdersBySymbol(string instrument_id, bool isReturnAll = false) { return(ServiceResult <List <FZOrder> > .CallAsyncFunction(() => _apiOrder.GetClosedOrdersBySymbol(instrument_id, isReturnAll)).Result); }
public ServiceResult <List <FZOrder> > GetAllOpenOrders() { return(ServiceResult <List <FZOrder> > .CallAsyncFunction(() => _apiOrder.GetAllOpenOrders()).Result); }
public ServiceResult <bool> CancelOrder(string symbol, string orderId, bool isStopOrder) { return(ServiceResult <bool> .CallAsyncFunction(() => _apiOrder.CancelOrder(symbol, orderId, isStopOrder)).Result); }
//public ServiceResult<List<FZOrder>> GetOpenStopOrder(string symbol) //{ // return ServiceResult<List<FZOrder>>.CallAsyncFunction(() => _apiOrder.GetOpenStopOrder(symbol)).Result; //} public ServiceResult <string> ModifyOrderPrice(string symbol, string orderId, double newPrice) { return(ServiceResult <string> .CallAsyncFunction(() => _apiOrder.ModifyOrderPrice(symbol, orderId, newPrice)).Result); }
public ServiceResult <FZOrder> PlaceOrder(FZOrder order) { return(ServiceResult <FZOrder> .CallAsyncFunction(() => _apiOrder.PlaceOrder(order)).Result); }
public ServiceResult <Dictionary <string, Ticker> > GetTickers() { return(ServiceResult <Dictionary <string, Ticker> > .CallAsyncFunction(() => _market.GetTickers()).Result); }
public ServiceResult <Ticker> GetTicker(string symbol) { return(ServiceResult <Ticker> .CallAsyncFunction(() => _market.GetTickerBySymbol(symbol)).Result); }
public ServiceResult <Orderbook> GetOrderbook(string symbol) { return(ServiceResult <Orderbook> .CallAsyncFunction(() => _market.GetOrderbook(symbol)).Result); }
public ServiceResult <List <OHLC> > GetOHLC(string symbol, int interval) { return(ServiceResult <List <OHLC> > .CallAsyncFunction(() => _market.GetOHLC(symbol, interval)).Result); }