You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
675 B

import { HttpError } from "./components/HttpError";
export interface CfdSellOrderPayload {
price: number;
min_quantity: number;
max_quantity: number;
}
export async function postCfdSellOrderRequest(payload: CfdSellOrderPayload) {
let res = await fetch(`/api/order/sell`, {
method: "POST",
body: JSON.stringify(payload),
headers: {
"Content-Type": "application/json",
},
credentials: "include",
});
if (!res.status.toString().startsWith("2")) {
console.log("Status: " + res.status + ", " + res.statusText);
const resp = await res.json();
throw new HttpError(resp);
}
}