Пример #1
0
        public async Task Add(OrderSideEnum orderSide)
        {
            using (var context = ContextFactory.CreateDbContext(null))
            {
                var entity = new OrderSideEntity
                {
                    OrderSideId = (int)orderSide,
                    Label       = orderSide.ToString()
                };

                if (await context.OrderSide.FindAsync(entity.OrderSideId) == null)
                {
                    await context.OrderSide.AddAsync(entity);

                    await context.SaveChangesAsync();
                }
            }
        }
Пример #2
0
        public async Task <WrappedResponse <CreateOrder> > CreateOrder(ISymbol symbol, OrderTypeEnum orderType, OrderSideEnum orderSide, decimal price, decimal volume)
        {
            var relativeUrl = "v3/order";

            var query = new NameValueCollection();

            query.Add("symbol", Exchange.GetSymbol(symbol));
            query.Add("side", orderSide.ToString().ToUpper());
            query.Add("type", orderType.ToString().ToUpper());
            query.Add("quantity", volume.ToString());

            if (orderType == OrderTypeEnum.Limit)
            {
                query.Add("price", price.ToString());
                query.Add("timeInForce", "GTC");
            }

            return(await InternalRequest <BinanceNewOrder, CreateOrder>(true, relativeUrl, HttpMethod.Post, query));
        }