コード例 #1
0
 public DigitalOptionsIdentifier(
     ActivePair pair,
     OrderDirection direction,
     DigitalOptionsExpiryDuration duration,
     DateTimeOffset now)
 {
     Pair       = pair;
     Direction  = direction;
     Duration   = duration;
     Expiration = DateTimeUtilities.GetExpirationTime(now.UtcDateTime, duration);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 /// <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));
 }
コード例 #4
0
 /// <inheritdoc/>
 public Task <DigitalOptionsPlacedResult> PlaceDigitalOptions(string requestId, ActivePair pair, OrderDirection direction,
                                                              DigitalOptionsExpiryDuration duration, double amount)
 => WsClient?.PlaceDigitalOptions(requestId, pair, direction, duration, amount);
コード例 #5
0
 public static DateTimeOffset GetExpirationTime(DateTimeOffset dt, DigitalOptionsExpiryDuration duration)
 {
     return(ExpirationTimeTable(dt)[(int)duration]);
 }