buy (SPOT)
僅可用於 trade()掛一筆買入訂單,每個週期最多可掛 500 筆訂單。
Input
exchange: string;
pair: string;
amount: number;
type: OrderType;
price: number;
查看 OrderType
範例
掛一筆數量為 1 的訂單市價單,市價單可不用設定 price。
exchange, pair, base, quote = CA.get_exchange_pair()
CA.buy(exchange, pair, 1, CA.OrderType.MARKET)
掛一筆數量為 1 的訂單限價單,價格為 close_price。
exchange, pair, base, quote = CA.get_exchange_pair()
close_price = candles[exchange][pair][0]['close']
CA.buy(exchange, pair, 1, CA.OrderType.LIMIT, close_price)