Exemple #1
0
 public object Visit(FuturePositionsUpdate msg)
 {
     try
     {
         _client.OnFuturePositionsUpdate?.Invoke(
             new TimestampedMsg <FuturePositionsUpdate>()
         {
             Received = _received, Value = msg
         });
     }
     catch (Exception e)
     {
         _log.Warn(e, "Ignoring exception from OnFuturePositionsUpdate");
     }
     return(null);
 }
Exemple #2
0
 // Called from the scheduler thread.
 void PollOne(Currency currency, CoinType coin)
 {
     foreach (var elem in _restClient.FuturePositions(currency, coin))
     {
         var update = new FuturePositionsUpdate()
         {
             Currency   = currency,
             CoinType   = coin,
             FutureType = elem.Key,
             Positions  = elem.Value,
         };
         var msg = new TimestampedMsg <FuturePositionsUpdate>()
         {
             Received = DateTime.UtcNow,
             Value    = update,
         };
         try { OnFuturePositions?.Invoke(msg); }
         catch (Exception e) { _log.Warn(e, "Ignoring exception from OnFuturePositions"); }
     }
 }