-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
43 lines (36 loc) · 1.47 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Depthmanager } from "./DepthManagar";
import { cancelAll, createOrder } from "./order";
const solInrMarket = new Depthmanager("B-XAI_INR");
const usdtInrMarket = new Depthmanager("B-USDT_INR");
const solUsdtMarket = new Depthmanager("B-XAI_USDT");
setInterval(() => {
console.log(solInrMarket.getRelevantDepth());
console.log(usdtInrMarket.getRelevantDepth());
console.log(solUsdtMarket.getRelevantDepth());
const canGetInr = solInrMarket.getRelevantDepth().lowestAsk - 0.001;
const canGetUsdt = canGetInr / usdtInrMarket.getRelevantDepth().lowestAsk;
const canGetSol = canGetUsdt / solUsdtMarket.getRelevantDepth().lowestAsk;
console.log(`You can convert ${1} SOL into ${canGetSol} SOL`);
const initialInr = solInrMarket.getRelevantDepth().highestBid + 0.001;
const canGetUsdt2 = solUsdtMarket.getRelevantDepth().highestBid;
const canGetInr2 = canGetUsdt2 * usdtInrMarket.getRelevantDepth().highestBid;
console.log(`You can convert ${initialInr} INR into ${canGetInr2} INR`);
}, 2000);
async function main() {
const highestBid = solInrMarket.getRelevantDepth().highestBid;
console.log(`placing order for ${parseFloat(highestBid) + 0.01}`);
await createOrder(
"buy",
"XAIINR",
(parseFloat(highestBid) + 0.01).toFixed(3),
10,
Math.random().toString(),
);
await new Promise((r) => setTimeout(r, 10000));
await cancelAll("XAIINR");
await new Promise((r) => setTimeout(r, 1000));
main();
}
setTimeout(async () => {
main();
}, 2000);