Files
Funding_Rate/aster.ipynb

603 lines
20 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "3a269644",
"metadata": {},
"outputs": [],
"source": [
"import modules.aster_auth as aster_auth"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4395fabb",
"metadata": {},
"outputs": [],
"source": [
"listen_key_request = {\n",
" \"url\": \"/fapi/v3/listenKey\",\n",
" \"method\": \"POST\",\n",
" \"params\": {}\n",
"}\n",
"cancel_all_open_orders = {\n",
" \"url\": \"/fapi/v3/allOpenOrders\",\n",
" \"method\": \"DELETE\",\n",
" \"params\": {\n",
" 'symbol': 'ETHUSDT',\n",
" }\n",
"}\n",
"cancel_order = {\n",
" \"url\": \"/fapi/v3/order\",\n",
" \"method\": \"DELETE\",\n",
" \"params\": {\n",
" 'symbol': 'ETHUSDT',\n",
" 'orderId': 17349955824,\n",
" }\n",
"}\n",
"fut_acct_balances = {\n",
" \"url\": \"/fapi/v3/balance\",\n",
" \"method\": \"GET\",\n",
" \"params\": {}\n",
"}\n",
"fut_acct_openOrders = {\n",
" \"url\": \"/fapi/v3/openOrders\",\n",
" \"method\": \"GET\",\n",
" \"params\": {}\n",
"}\n",
"fut_acct_positionRisk = {\n",
" \"url\": \"/fapi/v3/positionRisk\",\n",
" \"method\": \"GET\",\n",
" \"params\": {\n",
" 'symbol': 'ETHUSDT',\n",
" }\n",
"}\n",
"fut_acct_exchangeInfo = {\n",
" \"url\": \"/fapi/v3/exchangeInfo\",\n",
" \"method\": \"GET\",\n",
" \"params\": {}\n",
"}\n",
"commission_rate = {\n",
" \"url\": \"/fapi/v3/commissionRate\",\n",
" \"method\": \"GET\",\n",
" \"params\": {\n",
" 'symbol': 'ETHUSDT',\n",
" }\n",
"}\n",
"post_order = {\n",
" \"url\": \"/fapi/v3/order\",\n",
" \"method\": \"POST\",\n",
" \"params\": {\n",
" 'symbol': 'ETHUSDT',\n",
" 'side': 'SELL',\n",
" 'type': 'LIMIT',\n",
" 'timeInForce': 'GTC',\n",
" 'quantity': '0.01',\n",
" 'price': '2500',\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2122885a",
"metadata": {},
"outputs": [],
"source": [
"j = await aster_auth.post_authenticated_url(fut_acct_positionRisk)\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e895ac52",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'symbol': 'ETHUSDT',\n",
" 'positionAmt': '-0.214',\n",
" 'entryPrice': '2327.21',\n",
" 'markPrice': '2326.46000000',\n",
" 'unRealizedProfit': '0.16050000',\n",
" 'liquidationPrice': '2444.20070305',\n",
" 'leverage': '150',\n",
" 'maxNotionalValue': '300000',\n",
" 'marginType': 'cross',\n",
" 'isolatedMargin': '0.00000000',\n",
" 'isAutoAddMargin': 'false',\n",
" 'positionSide': 'BOTH',\n",
" 'notional': '-497.86244000',\n",
" 'isolatedWallet': '0',\n",
" 'updateTime': 1777182273777}]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"j"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d5de2d25",
"metadata": {},
"outputs": [],
"source": [
"import requests\n"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "6de7227b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"216.842"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r = requests.get('https://fapi.asterdex.com/fapi/v3/ping')\n",
"r.elapsed.total_seconds()*1000"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "d70b81ab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"818.9119999999999"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r = requests.get('https://api.starknet.extended.exchange/api/v1/info/markets/ETH-USD/trades')\n",
"r.elapsed.total_seconds()*1000"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'{\"status\":\"OK\",\"data\":[{\"i\":2048281060801777676,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183234774,\"p\":\"2329.5\",\"q\":\"0.011\"},{\"i\":2048281060801777677,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183234774,\"p\":\"2329.6\",\"q\":\"0.500\"},{\"i\":2048281062441750529,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183235165,\"p\":\"2329.7\",\"q\":\"0.010\"},{\"i\":2048281062441750530,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183235165,\"p\":\"2329.7\",\"q\":\"0.146\"},{\"i\":2048281069555290113,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183236861,\"p\":\"2329.6\",\"q\":\"0.147\"},{\"i\":2048281092531687424,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183242339,\"p\":\"2329.7\",\"q\":\"0.012\"},{\"i\":2048281428902285317,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183322536,\"p\":\"2329.7\",\"q\":\"0.266\"},{\"i\":2048281428927451138,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183322542,\"p\":\"2329.7\",\"q\":\"0.092\"},{\"i\":2048281434937888768,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183323975,\"p\":\"2329.8\",\"q\":\"0.250\"},{\"i\":2048281434942083072,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183323976,\"p\":\"2329.8\",\"q\":\"0.250\"},{\"i\":2048281434942083073,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183323976,\"p\":\"2329.8\",\"q\":\"0.084\"},{\"i\":2048281434942083074,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183323976,\"p\":\"2329.8\",\"q\":\"0.058\"},{\"i\":2048281448279969795,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183327156,\"p\":\"2330.0\",\"q\":\"0.110\"},{\"i\":2048281448477102080,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183327203,\"p\":\"2330.0\",\"q\":\"0.390\"},{\"i\":2048281462658043904,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183330584,\"p\":\"2330.2\",\"q\":\"0.500\"},{\"i\":2048281462658043905,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183330584,\"p\":\"2330.2\",\"q\":\"0.868\"},{\"i\":2048281616119238656,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183367172,\"p\":\"2330.0\",\"q\":\"0.500\"},{\"i\":2048281710952452097,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183389782,\"p\":\"2329.8\",\"q\":\"0.169\"},{\"i\":2048281718711914496,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183391632,\"p\":\"2329.8\",\"q\":\"0.102\"},{\"i\":2048281768477331457,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183403497,\"p\":\"2329.8\",\"q\":\"0.407\"},{\"i\":2048281768519274496,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183403507,\"p\":\"2329.8\",\"q\":\"1.672\"},{\"i\":2048281773514690563,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183404698,\"p\":\"2329.6\",\"q\":\"0.500\"},{\"i\":2048281853550399489,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183423780,\"p\":\"2329.6\",\"q\":\"0.090\"},{\"i\":2048281858856194048,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183425045,\"p\":\"2329.6\",\"q\":\"0.010\"},{\"i\":2048281867026698240,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183426993,\"p\":\"2329.5\",\"q\":\"0.011\"},{\"i\":2048281904020459520,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183435813,\"p\":\"2329.4\",\"q\":\"0.500\"},{\"i\":2048281904074985480,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183435826,\"p\":\"2329.3\",\"q\":\"0.043\"},{\"i\":2048281904074985481,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183435826,\"p\":\"2329.3\",\"q\":\"0.043\"},{\"i\":2048281946777194496,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183446007,\"p\":\"2329.2\",\"q\":\"0.259\"},{\"i\":2048281958982619136,\"m\":\"ETH-USD\",\"S\":\"SELL\",\"tT\":\"TRADE\",\"T\":1777183448917,\"p\":\"2329.2\",\"q\":\"0.241\"},{\"i\":2048282097155575814,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481860,\"p\":\"2329.4\",\"q\":\"0.500\"},{\"i\":2048282097155575815,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481860,\"p\":\"2329.4\",\"q\":\"0.056\"},{\"i\":2048282097575006208,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481960,\"p\":\"2329.6\",\"q\":\"0.500\"},{\"i\":2048282097575006209,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481960,\"p\":\"2329.7\",\"q\":\"0.046\"},{\"i\":2048282097575006210,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481960,\"p\":\"2329.8\",\"q\":\"0.500\"},{\"i\":2048282097575006211,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481960,\"p\":\"2329.8\",\"q\":\"0.223\"},{\"i\":2048282097575006212,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183481960,\"p\":\"2329.8\",\"q\":\"0.062\"},{\"i\":2048282099558912002,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183482433,\"p\":\"2329.9\",\"q\":\"0.078\"},{\"i\":2048282099558912003,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183482433,\"p\":\"2329.9\",\"q\":\"0.373\"},{\"i\":2048282132433866756,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183490271,\"p\":\"2329.9\",\"q\":\"0.368\"},{\"i\":2048282132719079424,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183490339,\"p\":\"2329.9\",\"q\":\"1.200\"},{\"i\":2048282175693918208,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500585,\"p\":\"2329.9\",\"q\":\"0.906\"},{\"i\":2048282176276926464,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500724,\"p\":\"2329.9\",\"q\":\"0.150\"},{\"i\":2048282177048678400,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500908,\"p\":\"2329.9\",\"q\":\"1.295\"},{\"i\":2048282177048678401,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500908,\"p\":\"2329.9\",\"q\":\"3.775\"},{\"i\":2048282177048678402,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500908,\"p\":\"2329.9\",\"q\":\"0.030\"},{\"i\":2048282177048678403,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183500908,\"p\":\"2329.9\",\"q\":\"0.032\"},{\"i\":2048282190487228416,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183504112,\"p\":\"2330.0\",\"q\":\"0.113\"},{\"i\":2048282212599599106,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183509384,\"p\":\"2330.0\",\"q\":\"0.387\"},{\"i\":2048282212872228864,\"m\":\"ETH-USD\",\"S\":\"BUY\",\"tT\":\"TRADE\",\"T\":1777183509449,\"p\":\"2330.1\",\"q\":\"0.493\"}]}'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"r.text"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "e61dca73",
"metadata": {},
"outputs": [],
"source": [
"d = [d for d in j if d.get('symbol', None) == 'ETHUSDT'][0]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f0538cde",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'symbol': 'ETHUSDT',\n",
" 'positionAmt': '0.000',\n",
" 'entryPrice': '0.0',\n",
" 'markPrice': '2317.47321317',\n",
" 'unRealizedProfit': '0.00000000',\n",
" 'liquidationPrice': '0',\n",
" 'leverage': '150',\n",
" 'maxNotionalValue': '300000',\n",
" 'marginType': 'cross',\n",
" 'isolatedMargin': '0.00000000',\n",
" 'isAutoAddMargin': 'false',\n",
" 'positionSide': 'BOTH',\n",
" 'notional': '0',\n",
" 'isolatedWallet': '0',\n",
" 'updateTime': 1776996575970}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "80b9c0e5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-499.15475000000004"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"float(d['notional'])-float(d['unRealizedProfit'])"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime\n",
"t = round(datetime.now().timestamp()*1000)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "ebded6ad",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Timestamp('2026-04-23 23:17:32.516000')"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"pd.to_datetime(t, unit='ms')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "67a3bbb2",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 23,
"id": "e958e7da",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"### User Data Stream ###\n",
"# After posting limit order to rest\n",
"after_order_post = json.loads('{\"e\":\"ORDER_TRADE_UPDATE\",\"T\":1776836992350,\"E\":1776836992388,\"o\":{\"s\":\"ETHUSDT\",\"c\":\"KFi375tZh5kzHsQJWKMJHe\",\"S\":\"BUY\",\"o\":\"LIMIT\",\"f\":\"GTC\",\"q\":\"0.010\",\"p\":\"2100\",\"ap\":\"0\",\"sp\":\"0\",\"x\":\"NEW\",\"X\":\"NEW\",\"i\":17341121450,\"l\":\"0\",\"z\":\"0\",\"L\":\"0\",\"T\":1776836992350,\"t\":0,\"b\":\"21\",\"a\":\"0\",\"m\":false,\"R\":false,\"wt\":\"CONTRACT_PRICE\",\"ot\":\"LIMIT\",\"ps\":\"BOTH\",\"cp\":false,\"rp\":\"0\",\"pP\":false,\"si\":0,\"ss\":0,\"h\":\"0xeec41a368072d5a47c13b3ad83703eded2e2b8cf9ff427095beb8b7684968db0\"}}')\n",
"\n",
"# After order cancellation in GUI\n",
"after_order_cxl = json.loads('{\"e\":\"ORDER_TRADE_UPDATE\",\"T\":1776836998500,\"E\":1776836998533,\"o\":{\"s\":\"ETHUSDT\",\"c\":\"KFi375tZh5kzHsQJWKMJHe\",\"S\":\"BUY\",\"o\":\"LIMIT\",\"f\":\"GTC\",\"q\":\"0.010\",\"p\":\"2100\",\"ap\":\"0\",\"sp\":\"0\",\"x\":\"CANCELED\",\"X\":\"CANCELED\",\"i\":17341121450,\"l\":\"0\",\"z\":\"0\",\"L\":\"0\",\"T\":1776836998500,\"t\":0,\"b\":\"0\",\"a\":\"0\",\"m\":false,\"R\":false,\"wt\":\"CONTRACT_PRICE\",\"ot\":\"LIMIT\",\"ps\":\"BOTH\",\"cp\":false,\"rp\":\"0\",\"pP\":false,\"si\":0,\"ss\":0,\"h\":\"0x116bb48a4b41420aebbc76343d6f55f22d1ccbc36b04462e6172571fda836599\"}}')\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'e': 'ORDER_TRADE_UPDATE',\n",
" 'T': 1776836992350,\n",
" 'E': 1776836992388,\n",
" 'o': {'s': 'ETHUSDT',\n",
" 'c': 'KFi375tZh5kzHsQJWKMJHe',\n",
" 'S': 'BUY',\n",
" 'o': 'LIMIT',\n",
" 'f': 'GTC',\n",
" 'q': '0.010',\n",
" 'p': '2100',\n",
" 'ap': '0',\n",
" 'sp': '0',\n",
" 'x': 'NEW',\n",
" 'X': 'NEW',\n",
" 'i': 17341121450,\n",
" 'l': '0',\n",
" 'z': '0',\n",
" 'L': '0',\n",
" 'T': 1776836992350,\n",
" 't': 0,\n",
" 'b': '21',\n",
" 'a': '0',\n",
" 'm': False,\n",
" 'R': False,\n",
" 'wt': 'CONTRACT_PRICE',\n",
" 'ot': 'LIMIT',\n",
" 'ps': 'BOTH',\n",
" 'cp': False,\n",
" 'rp': '0',\n",
" 'pP': False,\n",
" 'si': 0,\n",
" 'ss': 0,\n",
" 'h': '0xeec41a368072d5a47c13b3ad83703eded2e2b8cf9ff427095beb8b7684968db0'}}"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"after_order_post"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "1ea320f2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'e': 'ORDER_TRADE_UPDATE',\n",
" 'T': 1776836998500,\n",
" 'E': 1776836998533,\n",
" 'o': {'s': 'ETHUSDT',\n",
" 'c': 'KFi375tZh5kzHsQJWKMJHe',\n",
" 'S': 'BUY',\n",
" 'o': 'LIMIT',\n",
" 'f': 'GTC',\n",
" 'q': '0.010',\n",
" 'p': '2100',\n",
" 'ap': '0',\n",
" 'sp': '0',\n",
" 'x': 'CANCELED',\n",
" 'X': 'CANCELED',\n",
" 'i': 17341121450,\n",
" 'l': '0',\n",
" 'z': '0',\n",
" 'L': '0',\n",
" 'T': 1776836998500,\n",
" 't': 0,\n",
" 'b': '0',\n",
" 'a': '0',\n",
" 'm': False,\n",
" 'R': False,\n",
" 'wt': 'CONTRACT_PRICE',\n",
" 'ot': 'LIMIT',\n",
" 'ps': 'BOTH',\n",
" 'cp': False,\n",
" 'rp': '0',\n",
" 'pP': False,\n",
" 'si': 0,\n",
" 'ss': 0,\n",
" 'h': '0x116bb48a4b41420aebbc76343d6f55f22d1ccbc36b04462e6172571fda836599'}}"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"after_order_cxl"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "07ef4360",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Timestamp('2019-09-19 07:51:05.651000')"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"\n",
"pd.to_datetime(1568879465651, unit='ms')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'ok': True,\n",
" 'result': {'message_id': 24,\n",
" 'sender_chat': {'id': -1003864341457,\n",
" 'title': 'Atwater_Alert',\n",
" 'type': 'channel'},\n",
" 'chat': {'id': -1003864341457, 'title': 'Atwater_Alert', 'type': 'channel'},\n",
" 'date': 1777009128,\n",
" 'text': 'alert!'}}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import modules.utils as utils\n",
"\n",
"utils.send_tg_alert('alert!')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "284b7266",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sd'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"sdfsdfsfdsdfs\"[:2]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "98ed3a27",
"metadata": {},
"outputs": [],
"source": [
"from dataclasses import dataclass\n",
"\n",
"@dataclass(kw_only=True)\n",
"class Flags:\n",
" LIQUIDATE_POS_AND_KILL_ALGO_FLAG: bool = False\n",
" NET_FUNDING_IS_ZERO: bool = False\n",
" # list = field(init=False) \n",
"Flags = Flags()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "73a525c2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Flags(LIQUIDATE_POS_AND_KILL_ALGO_FLAG=False, NET_FUNDING_IS_ZERO=False)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Flags"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "094e374c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "15c3bcef",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "940ceba7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "py_313",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}