feedhandlers extended
This commit is contained in:
227
aster.ipynb
227
aster.ipynb
@@ -2,17 +2,17 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"id": "3a269644",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import modules.aster_auth_api as aster_auth_api"
|
||||
"import modules.aster_auth as aster_auth"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 27,
|
||||
"id": "4395fabb",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -57,17 +57,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "2122885a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'orderId': 17340952438,\n",
|
||||
"{'orderId': 17341253499,\n",
|
||||
" 'symbol': 'ETHUSDT',\n",
|
||||
" 'status': 'NEW',\n",
|
||||
" 'clientOrderId': '57UkyWpQE4iRP74eAwt7Hf',\n",
|
||||
" 'clientOrderId': 'J1SvsvvDhlDAqwGau1T77F',\n",
|
||||
" 'price': '2100',\n",
|
||||
" 'avgPrice': '0.00000',\n",
|
||||
" 'origQty': '0.010',\n",
|
||||
@@ -84,18 +84,18 @@
|
||||
" 'workingType': 'CONTRACT_PRICE',\n",
|
||||
" 'priceProtect': False,\n",
|
||||
" 'origType': 'LIMIT',\n",
|
||||
" 'updateTime': 1776835456300,\n",
|
||||
" 'newChainData': {'hash': '0x12456fb0e14021975aa03e56adb339f8b906710ec3a8604a73a8b697c7ee1225'}}"
|
||||
" 'updateTime': 1776838867250,\n",
|
||||
" 'newChainData': {'hash': '0xa2c23513491587b2961bfa77d2077489a14522d7ce359a9e3635e7c4f0d12a22'}}"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 28,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"j = aster_auth_api.post_authenticated_url(post_order)\n",
|
||||
"j"
|
||||
"# j = aster_auth_api.post_authenticated_url(post_order)\n",
|
||||
"# j"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -103,9 +103,197 @@
|
||||
"execution_count": null,
|
||||
"id": "45d68bf4",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1776836583531"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from datetime import datetime\n",
|
||||
"round(datetime.now().timestamp())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1800"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"30*60"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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": null,
|
||||
@@ -116,7 +304,22 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "fd513311",
|
||||
"id": "284b7266",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "98ed3a27",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in New Issue
Block a user