private async static void marketDataThread() { A: disconnect_flg = false; //var api = new API(); //var api2 = new API(); var api3 = new API(); //api.Subscribe<Tick>(api.TickerFxBtcJpy, OnReceive, OnConnect, OnError); //api2.Subscribe<BoardDiff>(api.boardFxBtcJpy, OnReceiveBoard, OnConnectBoard, OnError); api3.Subscribe <List <Executions> >(api3.ExecutionsFxBtcJpy, OnReceiveExecutions, OnConnectExecutions, OnErrorExecutions); while (SystemFlg.getMarketDataFlg()) { await Task.Delay(300); //Thread.Sleep(10); Form1.Form1Instance.Invoke((Action)(() => { Form1.Form1Instance.setLabel("num executions log=" + MarketDataLog.getNumExecutionsLog().ToString()); Form1.Form1Instance.setLabel2("num board data log=" + MarketDataLog.getNumBoardData().ToString()); })); if (disconnect_flg) { goto A;//make new instance when unexpectedlly disconnected } } api3.unsubscribe(); }
private static void writeBoardData() { if (MarketDataLog.getNumBoardData() > 100) { DBManager.insertBoardData(MarketDataLog.getAllBoardData()); } }