Esempio n. 1
0
        public async Task Handle(CreateOrderCommand message)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return;
            }

            var order = new OrderBitfinex  {
                amount         = message.amount,
                buy_price_oco  = message.buy_price_oco,
                is_hidden      = message.is_hidden,
                is_postonly    = message.is_postonly,
                ocoorder       = message.ocoorder,
                price          = message.price,
                sell_price_oco = message.sell_price_oco,
                side           = message.side,
                symbol         = message.symbol,
                type           = message.type
            };

            var result = await _bitfinexRepository.CreateOrder(order).ConfigureAwait(false);

            if (result.Id > 0)
            {
                await Bus.RaiseEvent(new OrderCreatedEvent(result.Id, result.Symbol, result.Exchange, result.Price));
            }
        }
Esempio n. 2
0
        public async Task <OrderBitfinexResult> CreateOrder(OrderBitfinex order)
        {
            var fullUrl = $"{pathV1}order/new";

            order.request = fullUrl;
            order.nonce   = new DateTime().UnixTimestamp().ToString();

            return(await PostAsJsonAsync <OrderBitfinexResult, OrderBitfinex>(fullUrl, order, GetAuth(order)).ConfigureAwait(false));
        }
Esempio n. 3
0
 public CreateOrderCommand(OrderBitfinex order)
 {
     symbol         = order.symbol;
     side           = order.side;
     is_hidden      = order.is_hidden;
     is_postonly    = order.is_postonly;
     ocoorder       = order.ocoorder;
     buy_price_oco  = order.buy_price_oco;
     amount         = order.amount;
     price          = order.price;
     sell_price_oco = order.sell_price_oco;
 }