2024-11-18 18:14:15.6180547 HTTP POST: sapi/v1/margin/isolated/transfer?asset=USDT&symbol=FISUSDT&transFrom=SPOT&transTo=ISOLATED_MARGIN&amount=600.25600000
2024-11-18 18:14:16.0301523 HTTP POST: sapi/v1/margin/loan?asset=FIS&symbol=FISUSDT&isIsolated=TRUE&amount=664
2024-11-18 18:14:16.4887579 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:14:16.8512529 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=0a8f9f43-85d1-427b-9092-a155982c96f7&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.4520
2024-11-18 18:14:17.2703873 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=8f3ed4b6-318a-4baf-b130-c69717fce40c&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.4972
2024-11-18 18:14:17.6542642 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=3890165a-8757-4259-b0c7-c0cc30d7a65c&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.5424
2024-11-18 18:14:18.0527827 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=649ca3bd-d67c-47f4-84a9-84a020c0fb4d&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.5876
2024-11-18 18:14:18.4609548 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=ad2914c8-d391-4cf5-8741-9b529d94e1c5&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.6780
2024-11-18 18:14:18.8694552 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=b0e2f0e8-6b07-40c1-90d8-518c0b746262&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.7910
2024-11-18 18:14:19.2631747 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=dbf2fe40-95d2-4389-b518-b6161c779fcd&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.9040
2024-11-18 18:14:19.6894030 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=7e0fc0f5-16b8-4076-a260-4969100ba152&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=1.0170
2024-11-18 18:14:20.0796859 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=b9c774e8-2b28-4938-af70-e395859feeca&side=SELL&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=1.1300
2024-11-18 18:14:34.2261354 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:14:34.2270297 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:14:34.2272180 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:14:34.6121832 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:14:37.8336296 HTTP DELETE: sapi/v1/margin/order?symbol=FISUSDT&orderId=351576122&isIsolated=TRUE
2024-11-18 18:14:38.1971037 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=6828ee7b-509a-4a6f-87fc-2f9fb3423b66&side=SELL&type=MARKET&quantity=73&newOrderRespType=FULL&isIsolated=TRUE
2024-11-18 18:14:46.8890770 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:14:46.8898790 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:14:46.8900779 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:14:47.3184392 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:14:48.8179639 HTTP POST: api/v3/order?symbol=FISUSDT&newClientOrderId=66c7ded3-9e54-46c5-bb28-760761cba42d&side=BUY&type=LIMIT&quantity=73&newOrderRespType=FULL&timeInForce=GTC&price=0.3898
2024-11-18 18:15:21.6409745 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:15:21.6417809 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:15:21.6419926 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:15:22.0332160 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:17:03.1128821 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:17:03.1137619 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:17:03.1141723 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:17:03.4845309 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:17:21.5607173 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:17:21.5619026 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:17:21.5621176 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:17:21.9354069 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:21:13.9126221 HTTP PUT: sapi/v1/userDataStream/isolated?symbol=FISUSDT&listenKey=iNpqtOQMZJMGXbpCO3VMLWJkhLZhJKSfpBzUxsrfiPpFpCACLaUtERp2O38F
2024-11-18 18:23:06.0633548 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=aa1d886b-ac3d-4fcc-b29b-1f2b0664e9b1&side=BUY&type=LIMIT&quantity=73&newOrderRespType=FULL&isIsolated=TRUE&timeInForce=GTC&price=0.4162
2024-11-18 18:41:16.2988419 HTTP PUT: sapi/v1/userDataStream/isolated?symbol=FISUSDT&listenKey=iNpqtOQMZJMGXbpCO3VMLWJkhLZhJKSfpBzUxsrfiPpFpCACLaUtERp2O38F
2024-11-18 18:49:38.0498967 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:49:38.0512641 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:49:38.0515100 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:49:38.6545057 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:49:47.9458688 HTTP DELETE: api/v3/order?symbol=FISUSDT&orderId=351591809
2024-11-18 18:49:48.3173559 HTTP POST: api/v3/order?symbol=FISUSDT&newClientOrderId=d12220c0-e1a6-4903-9952-1ab71341f301&side=BUY&type=MARKET&quantity=73&newOrderRespType=FULL
2024-11-18 18:51:18.8570814 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:51:18.8580474 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:51:18.8583818 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:51:19.2464225 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:54:35.2401952 HTTP GET: api/v3/allOrders?symbol=FISUSDT&orderId=0&limit=1000
2024-11-18 18:54:35.2416486 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=FALSE
2024-11-18 18:54:35.2419402 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:54:35.8489571 HTTP GET: sapi/v1/margin/allOrders?symbol=FISUSDT&orderId=0&limit=500&isIsolated=TRUE
2024-11-18 18:54:44.7296199 HTTP DELETE: sapi/v1/margin/order?symbol=FISUSDT&orderId=351744282&isIsolated=TRUE
2024-11-18 18:54:51.4326177 HTTP DELETE: sapi/v1/margin/openOrders?symbol=FISUSDT&isIsolated=TRUE
2024-11-18 18:54:51.8908721 HTTP GET: sapi/v1/margin/isolated/account?symbols=FISUSDT
2024-11-18 18:54:52.2278553 HTTP POST: sapi/v1/margin/order?symbol=FISUSDT&newClientOrderId=c4036e80-0a43-4858-ac41-8ceb3d8fba39&side=BUY&type=MARKET&quantity=147&newOrderRespType=FULL&isIsolated=TRUE
2024-11-18 18:54:52.6631404 HTTP POST: sapi/v1/margin/repay?asset=FIS&symbol=FISUSDT&isIsolated=TRUE&amount=664.0152228
Last 4 steps:
- I close all the orders
- query account info
- create order with amount = 147
- repay the debt
I borrowed 664 FIS, sold 73 + 73, bought 73, closed all the orders, and got free amount = 518. After that I calculated the amount to buy to repay as 664 – 518 = 147, that is incorrect, the correct amount to repay is 73.
I mistakenly created a Spot order.
Used the following BASH commands to extract API queries from logs:
sed -n '/Network Trace HTTP/p' binance-api-log.txt > api-queries.txt
sed -n '/symbol=FISUSDT/p' api-queries.txt > api-queries-fis.txt
sed '/klines/d' api-queries-fis1.txt > api-queries-fis2.txt
sed – how to remove all lines that do not match
https://unix.stackexchange.com/questions/223897/sed-how-to-remove-all-lines-that-do-not-match
How to delete from a text file, all lines that contain a specific string?
https://stackoverflow.com/questions/5410757/how-to-delete-from-a-text-file-all-lines-that-contain-a-specific-string