Exemplo n.º 1
0
 public static OvernightSwapCalculation Create(IOvernightSwapState state)
 {
     return(new OvernightSwapCalculation
     {
         AccountId = state.AccountId,
         Instrument = state.Instrument,
         Direction = state.Direction,
         Time = state.Time,
         OpenOrderIds = state.OpenOrderIds,
         Value = state.Value,
         SwapRate = state.SwapRate,
         IsSuccess = true
     });
 }
Exemplo n.º 2
0
 public static OvernightSwapStateEntity Create(IOvernightSwapState obj)
 {
     return(new OvernightSwapStateEntity
     {
         PartitionKey = obj.AccountId,
         RowKey = GetKey(obj.AccountId, obj.Instrument, obj.Direction),
         AccountId = obj.AccountId,
         Instrument = obj.Instrument,
         Direction = obj.Direction?.ToString(),
         Time = obj.Time,
         OpenOrderIds = JsonConvert.SerializeObject(obj.OpenOrderIds),
         Value = (double)obj.Value,
         SwapRate = (double)obj.SwapRate
     });
 }
Exemplo n.º 3
0
 public static OvernightSwapStateEntity Create(IOvernightSwapState obj)
 {
     return(new OvernightSwapStateEntity
     {
         PartitionKey = obj.AccountId,
         RowKey = obj.OpenOrderId,
         ClientId = obj.ClientId,
         AccountId = obj.AccountId,
         Instrument = obj.Instrument,
         Direction = obj.Direction?.ToString(),
         Time = obj.Time,
         Volume = (double)obj.Volume,
         Value = (double)obj.Value,
         SwapRate = (double)obj.SwapRate,
         OpenOrderId = obj.OpenOrderId,
     });
 }
Exemplo n.º 4
0
 public async Task DeleteAsync(IOvernightSwapState obj)
 {
     var entity = OvernightSwapStateEntity.Create(obj);
     await _tableStorage.DeleteIfExistAsync(entity.PartitionKey, entity.RowKey);
 }
Exemplo n.º 5
0
 public async Task AddOrReplaceAsync(IOvernightSwapState obj)
 {
     await _tableStorage.InsertOrReplaceAsync(OvernightSwapStateEntity.Create(obj));
 }