public DigitalOptionsIdentifier( ActivePair pair, OrderDirection direction, DigitalOptionsExpiryDuration duration, DateTimeOffset now) { Pair = pair; Direction = direction; Duration = duration; Expiration = DateTimeUtilities.GetExpirationTime(now.UtcDateTime, duration); }
public void TestCreate_InstrumentId( ActivePair active, OrderDirection direction, DigitalOptionsExpiryDuration duration, string expected) { var specificDate = DateTimeOffset.Parse("2018-11-10 12:50:50Z"); var result = new DigitalOptionsIdentifier(active, direction, duration, specificDate); result.ToString() .Should().Be(expected); }
/// <summary> /// Place the DigitalOptions order /// </summary> /// <param name="requestId">Request identifier<example>5f2c370145a047c7b87f2680556b3b93</example></param> /// <param name="pair">The Active pair, make sure your place with correct active.</param> /// <param name="direction">The position direction.</param> /// <param name="duration">The duration period in (1Min, 5Min, 15Min) from now</param> /// <param name="amount">The Amount of position</param> /// <returns></returns> public Task <DigitalOptionsPlacedResult> PlaceDigitalOptions(string requestId, ActivePair pair, OrderDirection direction, DigitalOptionsExpiryDuration duration, double amount) { return(SendMessageAsync(requestId, new PlaceDigitalOptionsMessageRequest(new DigitalOptionsIdentifier( pair, direction, duration, ServerTime), (int)Profile.BalanceId, amount), PlaceDigitalOptionResultObservable)); }
/// <inheritdoc/> public Task <DigitalOptionsPlacedResult> PlaceDigitalOptions(string requestId, ActivePair pair, OrderDirection direction, DigitalOptionsExpiryDuration duration, double amount) => WsClient?.PlaceDigitalOptions(requestId, pair, direction, duration, amount);
public static DateTimeOffset GetExpirationTime(DateTimeOffset dt, DigitalOptionsExpiryDuration duration) { return(ExpirationTimeTable(dt)[(int)duration]); }