Skip to content

Commit

Permalink
feat(auth): add replaceOrder method
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Dec 28, 2019
1 parent 5f68c85 commit d4b1443
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/auth1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ export type OrderParams = Symb & {
lev?: number;
};

export type ReplaceOrderParams = Symb & {
order_id: number;
amount: string;
price?: string;
exchange: "bitfinex";
side: "buy" | "sell";
type: OrderType;
is_hidden?: boolean;
is_postonly?: boolean;
use_remaining?: boolean;
lev?: number;
aff_code?: string;
};

export type AccountInfo = [
{
leo_fee_disc_c2c: string;
Expand Down Expand Up @@ -327,6 +341,17 @@ export class AuthenticatedClient1 extends PublicClient1 {
return this.post({ uri: "/v1/order/cancel/all" });
}

/**
* Replace an order with a new one. Can be used to replace an order with a new margin, exchange, or derivative order.
*/
replaceOrder({
symbol = this.symbol,
...body
}: ReplaceOrderParams): Promise<OrderResponse> {
const uri = "/v1/order/cancel/replace";
return this.post({ body: { symbol, ...body }, uri });
}

set nonce(nonce: () => string) {
this._nonce = nonce;
}
Expand Down

0 comments on commit d4b1443

Please sign in to comment.