Skip to main content

buy (SPOT)

This function can only be used in trade().

To put one buy order. Each period can put at max 500# orders.

Input

exchange: string;
pair: string;
amount: number;
type: OrderType;
price: number;

Check OrderType

Example

To put one buy order with market price for 1 amount. It is not necassery to set price with market price order.

exchange, pair, target, base = CA.get_exchange_pair()
CA.buy(exchange, pair, 1, CA.OrderType.MARKET)

To put one buy order with limit price for 1 amount. The limit price is set as close_price.

exchange, pair, target, base = CA.get_exchange_pair()
close_price = candles[exchange][pair][0]['close']
CA.buy(exchange, pair, 1, CA.OrderType.LIMIT, close_price)