{ "cells": [ { "cell_type": "code", "execution_count": 109, "id": "44ff5c50", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from pprint import pprint\n", "from sqlalchemy import create_engine, text\n", "import plotly.express as px\n", "import requests\n", "import json\n", "import time\n", "from datetime import datetime\n", "import plotly.graph_objects as go\n", "from plotly.subplots import make_subplots\n", "import numpy as np\n", "from sqlalchemy.sql.elements import TextClause" ] }, { "cell_type": "code", "execution_count": 110, "id": "527235c9", "metadata": {}, "outputs": [], "source": [ "start_ts = 1777498660*1000" ] }, { "cell_type": "code", "execution_count": 111, "id": "ca48e11c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connection successful\n" ] } ], "source": [ "### MYSQL ###\n", "ENGINE = create_engine('mysql+pymysql://root:pwd@localhost/fund_rate')\n", "try:\n", " with ENGINE.connect() as conn:\n", " print(\"Connection successful\")\n", "except Exception as e:\n", " print(f\"Connection failed: {e}\") " ] }, { "cell_type": "code", "execution_count": 112, "id": "ec8f5d67", "metadata": {}, "outputs": [], "source": [ "### ASTER ###\n", "aster_orders = text(f'''\n", " SELECT *\n", " FROM fr_aster_user_order_trade\n", " WHERE timestamp_arrival > {start_ts}\n", "''')\n", "df_aster_orders = pd.read_sql(aster_orders, con=ENGINE)\n", "df_aster_orders['timestamp_dt'] = pd.to_datetime(df_aster_orders['timestamp_transaction'], unit='ms')\n", "df_aster_orders_fill = df_aster_orders.loc[df_aster_orders['execution_type']=='TRADE',:]\n", "df_aster_orders_fill = df_aster_orders_fill[['timestamp_transaction','order_trade_time_ts','timestamp_dt','order_id','trade_id','client_order_id','order_status','side','last_filled_qty','filled_accumulated_qty','commission','last_filled_price','realized_profit']].reset_index(drop=True)\n", "\n", "df_aster_trades = df_aster_orders_fill.groupby('order_id').agg({'timestamp_transaction': 'first','order_trade_time_ts':'last','order_status':'last','side':'last','last_filled_qty':'sum','filled_accumulated_qty':'last','commission':'sum','last_filled_price':'mean','realized_profit':'sum'}).reset_index()\n", "df_aster_trades['is_mkt_maker'] = df_aster_trades['commission'] == 0.00\n", "df_aster_trades['timestamp_ts'] = pd.to_datetime(df_aster_trades['order_trade_time_ts'], unit='ms')\n", "\n", "df_aster_trades = df_aster_trades.rename({'order_status':'status','filled_accumulated_qty':'filled_qty','commission':'payed_fee','last_filled_price':'price'}, axis=1)" ] }, { "cell_type": "code", "execution_count": 113, "id": "1cb4869a", "metadata": {}, "outputs": [], "source": [ "### EXTEND ###\n", "# Load and Transform Orders\n", "extend_orders = text(f'''\n", " SELECT *\n", " FROM fr_extended_user_order\n", " WHERE timestamp_arrival > {start_ts}\n", "''')\n", "df_extend_orders = pd.read_sql(extend_orders, con=ENGINE)\n", "df_extend_orders['timestamp_dt'] = pd.to_datetime(df_extend_orders['updated_time_ts'], unit='ms')\n", "df_extend_orders_fill = df_extend_orders.loc[df_extend_orders['status'].isin(['FILLED','PARTIALLY_FILLED']),:]\n", "df_extend_orders_fill = df_extend_orders_fill[['created_time_ts','updated_time_ts','timestamp_dt','order_id','external_id','status','side','qty','filled_qty','payed_fee','price','averagePrice']].reset_index(drop=True)\n", "\n", "# Trades\n", "df_extend_trades = df_extend_orders_fill.groupby('order_id').agg({'created_time_ts':'first','updated_time_ts':'last','status': 'last','side': 'last', 'filled_qty':'last','payed_fee':'sum','price':'last'}).reset_index()\n", "df_extend_trades['duration_sec_ast'] = ( df_extend_trades['updated_time_ts'] - df_extend_trades['created_time_ts'] ) / 1000\n", "df_extend_trades['is_mkt_maker'] = df_extend_trades['payed_fee'] == 0.00\n", "df_extend_trades['timestamp_ts'] = pd.to_datetime(df_extend_trades['updated_time_ts'], unit='ms')" ] }, { "cell_type": "code", "execution_count": 119, "id": "0ebf54b3", "metadata": {}, "outputs": [], "source": [ "def tie_trades_together_get_extend_from_aster(row):\n", " row = row.to_frame().T\n", " row.index=[1]\n", "\n", " extend_row = df_extend_trades[['order_id','timestamp_ts','status','side','filled_qty','payed_fee','price','is_mkt_maker']].loc[df_extend_trades['timestamp_ts']>row['timestamp_ts'].iloc[0],:].iloc[0]\n", " extend_row = extend_row.to_frame().T\n", " extend_row.index=[1]\n", "\n", " return_row = row.merge(extend_row, left_index=True, right_index=True, suffixes=('_ast','_ext'))\n", "\n", " return return_row.iloc[0]\n", "\n", "df_comb_trades = df_aster_trades[['order_id','timestamp_ts','status','side','filled_qty','payed_fee','price','is_mkt_maker']].apply(tie_trades_together_get_extend_from_aster, axis=1)\n", "df_comb_trades['buy_price'] = df_comb_trades['price_ast'].where(df_comb_trades['side_ast']=='BUY', df_comb_trades['price_ext'])\n", "df_comb_trades['sell_price'] = df_comb_trades['price_ast'].where(df_comb_trades['side_ast']=='SELL', df_comb_trades['price_ext'])\n", "df_comb_trades['buy_qty'] = df_comb_trades['filled_qty_ast'].where(df_comb_trades['side_ast']=='BUY', df_comb_trades['filled_qty_ext'])\n", "df_comb_trades['sell_qty'] = df_comb_trades['filled_qty_ast'].where(df_comb_trades['side_ast']=='SELL', df_comb_trades['filled_qty_ext'])\n", "df_comb_trades['buy_side'] = df_comb_trades['order_id_ast'].where(df_comb_trades['side_ast']=='BUY', df_comb_trades['order_id_ext'])\n", "df_comb_trades['buy_side'] = df_comb_trades['order_id_ast'] == df_comb_trades['buy_side']\n", "df_comb_trades['buy_side'] = df_comb_trades['buy_side'].replace(True, 'ASTER').replace(False,'EXTEND')\n", "\n", "df_comb_trades['per_trade_pnl'] = ( ( df_comb_trades['sell_price'] - df_comb_trades['buy_price'] ) * df_comb_trades['sell_qty'] ) - df_comb_trades['payed_fee_ast'] - df_comb_trades['payed_fee_ext']\n", "df_comb_trades['per_trade_pnl_pct'] = ( (df_comb_trades['sell_price']*df_comb_trades['sell_qty']) - (df_comb_trades['buy_price']*df_comb_trades['buy_qty']) ) / (df_comb_trades['buy_price']*df_comb_trades['buy_qty'])" ] }, { "cell_type": "code", "execution_count": 120, "metadata": {}, "outputs": [ { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "order_id_ast", "rawType": "int64", "type": "integer" }, { "name": "timestamp_ts_ast", "rawType": "datetime64[ms]", "type": "datetime" }, { "name": "status_ast", "rawType": "str", "type": "string" }, { "name": "side_ast", "rawType": "str", "type": "string" }, { "name": "filled_qty_ast", "rawType": "float64", "type": "float" }, { "name": "payed_fee_ast", "rawType": "float64", "type": "float" }, { "name": "price_ast", "rawType": "float64", "type": "float" }, { "name": "is_mkt_maker_ast", "rawType": "bool", "type": "boolean" }, { "name": "order_id_ext", "rawType": "str", "type": "string" }, { "name": "timestamp_ts_ext", "rawType": "datetime64[ms]", "type": "datetime" }, { "name": "status_ext", "rawType": "str", "type": "string" }, { "name": "side_ext", "rawType": "str", "type": "string" }, { "name": "filled_qty_ext", "rawType": "float64", "type": "float" }, { "name": "payed_fee_ext", "rawType": "float64", "type": "float" }, { "name": "price_ext", "rawType": "float64", "type": "float" }, { "name": "is_mkt_maker_ext", "rawType": "bool", "type": "boolean" }, { "name": "buy_price", "rawType": "float64", "type": "float" }, { "name": "sell_price", "rawType": "float64", "type": "float" }, { "name": "buy_qty", "rawType": "float64", "type": "float" }, { "name": "sell_qty", "rawType": "float64", "type": "float" }, { "name": "buy_side", "rawType": "object", "type": "string" }, { "name": "per_trade_pnl", "rawType": "float64", "type": "float" }, { "name": "per_trade_pnl_pct", "rawType": "float64", "type": "float" } ], "ref": "ba489ddb-f098-469d-8584-5f1564160359", "rows": [ [ "0", "17371700930", "2026-04-30 08:46:33.100000", "FILLED", "BUY", "0.441", "0.0", "2260.01", "True", "2049778331801128960", "2026-04-30 09:10:12.149000", "FILLED", "SELL", "0.441", "0.24869", "2255.7", "False", "2260.01", "2255.7", "0.441", "0.441", "ASTER", "-2.1494000000001763", "-0.0019070712076496412" ], [ "1", "17372582002", "2026-04-30 13:59:05", "FILLED", "SELL", "0.439", "0.0", "2262.5", "True", "2049851052585218048", "2026-04-30 13:59:15.023000", "FILLED", "BUY", "0.438", "0.0", "2261.7", "True", "2261.7", "2262.5", "0.438", "0.439", "EXTEND", "0.35120000000007984", "0.0026376288252886937" ], [ "2", "17372999630", "2026-04-30 15:32:12.700000", "FILLED", "BUY", "0.438", "0.0", "2274.09", "True", "2049881470860271616", "2026-04-30 16:00:02.415000", "FILLED", "SELL", "0.438", "0.247886", "2263.7", "False", "2274.09", "2263.7", "0.438", "0.438", "ASTER", "-4.798706000000144", "-0.00456886051123762" ], [ "3", "17373094474", "2026-04-30 16:00:02.050000", "FILLED", "SELL", "0.439", "0.0", "2264.61", "True", "2049881470860271616", "2026-04-30 16:00:02.415000", "FILLED", "SELL", "0.438", "0.247886", "2263.7", "False", "2263.7", "2264.61", "0.438", "0.439", "EXTEND", "0.15160400000013574", "0.002686019554602488" ], [ "4", "17373547036", "2026-04-30 19:06:50.200000", "FILLED", "BUY", "0.442", "0.0", "2260.48", "True", "2049929626042335232", "2026-04-30 19:11:23.505000", "FILLED", "SELL", "0.441", "0.24944", "2262.5", "False", "2260.48", "2262.5", "0.442", "0.441", "ASTER", "0.641379999999992", "-0.0013708496781846692" ], [ "5", "17373827670", "2026-04-30 21:48:38.550000", "FILLED", "SELL", "0.221", "0.0", "2257.17", "True", "2049969423813185536", "2026-04-30 21:49:32.034000", "FILLED", "BUY", "0.22", "0.124041", "2255.4", "False", "2255.4", "2257.17", "0.22", "0.221", "EXTEND", "0.26712899999999595", "0.0053338049287769895" ], [ "6", "17373941409", "2026-04-30 23:01:21.150000", "FILLED", "SELL", "0.221", "0.0", "2253.58", "True", "2049987504752680960", "2026-04-30 23:03:53.771000", "FILLED", "BUY", "0.221", "0.0", "2252.6", "True", "2252.6", "2253.58", "0.221", "0.221", "EXTEND", "0.21658000000000402", "0.0004350528278434247" ] ], "shape": { "columns": 23, "rows": 7 } }, "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
order_id_asttimestamp_ts_aststatus_astside_astfilled_qty_astpayed_fee_astprice_astis_mkt_maker_astorder_id_exttimestamp_ts_ext...payed_fee_extprice_extis_mkt_maker_extbuy_pricesell_pricebuy_qtysell_qtybuy_sideper_trade_pnlper_trade_pnl_pct
0173717009302026-04-30 08:46:33.100FILLEDBUY0.4410.02260.01True20497783318011289602026-04-30 09:10:12.149...0.2486902255.7False2260.012255.700.4410.441ASTER-2.149400-0.001907
1173725820022026-04-30 13:59:05.000FILLEDSELL0.4390.02262.50True20498510525852180482026-04-30 13:59:15.023...0.0000002261.7True2261.702262.500.4380.439EXTEND0.3512000.002638
2173729996302026-04-30 15:32:12.700FILLEDBUY0.4380.02274.09True20498814708602716162026-04-30 16:00:02.415...0.2478862263.7False2274.092263.700.4380.438ASTER-4.798706-0.004569
3173730944742026-04-30 16:00:02.050FILLEDSELL0.4390.02264.61True20498814708602716162026-04-30 16:00:02.415...0.2478862263.7False2263.702264.610.4380.439EXTEND0.1516040.002686
4173735470362026-04-30 19:06:50.200FILLEDBUY0.4420.02260.48True20499296260423352322026-04-30 19:11:23.505...0.2494402262.5False2260.482262.500.4420.441ASTER0.641380-0.001371
5173738276702026-04-30 21:48:38.550FILLEDSELL0.2210.02257.17True20499694238131855362026-04-30 21:49:32.034...0.1240412255.4False2255.402257.170.2200.221EXTEND0.2671290.005334
6173739414092026-04-30 23:01:21.150FILLEDSELL0.2210.02253.58True20499875047526809602026-04-30 23:03:53.771...0.0000002252.6True2252.602253.580.2210.221EXTEND0.2165800.000435
\n", "

7 rows × 23 columns

\n", "
" ], "text/plain": [ " order_id_ast timestamp_ts_ast status_ast side_ast filled_qty_ast \\\n", "0 17371700930 2026-04-30 08:46:33.100 FILLED BUY 0.441 \n", "1 17372582002 2026-04-30 13:59:05.000 FILLED SELL 0.439 \n", "2 17372999630 2026-04-30 15:32:12.700 FILLED BUY 0.438 \n", "3 17373094474 2026-04-30 16:00:02.050 FILLED SELL 0.439 \n", "4 17373547036 2026-04-30 19:06:50.200 FILLED BUY 0.442 \n", "5 17373827670 2026-04-30 21:48:38.550 FILLED SELL 0.221 \n", "6 17373941409 2026-04-30 23:01:21.150 FILLED SELL 0.221 \n", "\n", " payed_fee_ast price_ast is_mkt_maker_ast order_id_ext \\\n", "0 0.0 2260.01 True 2049778331801128960 \n", "1 0.0 2262.50 True 2049851052585218048 \n", "2 0.0 2274.09 True 2049881470860271616 \n", "3 0.0 2264.61 True 2049881470860271616 \n", "4 0.0 2260.48 True 2049929626042335232 \n", "5 0.0 2257.17 True 2049969423813185536 \n", "6 0.0 2253.58 True 2049987504752680960 \n", "\n", " timestamp_ts_ext ... payed_fee_ext price_ext is_mkt_maker_ext \\\n", "0 2026-04-30 09:10:12.149 ... 0.248690 2255.7 False \n", "1 2026-04-30 13:59:15.023 ... 0.000000 2261.7 True \n", "2 2026-04-30 16:00:02.415 ... 0.247886 2263.7 False \n", "3 2026-04-30 16:00:02.415 ... 0.247886 2263.7 False \n", "4 2026-04-30 19:11:23.505 ... 0.249440 2262.5 False \n", "5 2026-04-30 21:49:32.034 ... 0.124041 2255.4 False \n", "6 2026-04-30 23:03:53.771 ... 0.000000 2252.6 True \n", "\n", " buy_price sell_price buy_qty sell_qty buy_side per_trade_pnl \\\n", "0 2260.01 2255.70 0.441 0.441 ASTER -2.149400 \n", "1 2261.70 2262.50 0.438 0.439 EXTEND 0.351200 \n", "2 2274.09 2263.70 0.438 0.438 ASTER -4.798706 \n", "3 2263.70 2264.61 0.438 0.439 EXTEND 0.151604 \n", "4 2260.48 2262.50 0.442 0.441 ASTER 0.641380 \n", "5 2255.40 2257.17 0.220 0.221 EXTEND 0.267129 \n", "6 2252.60 2253.58 0.221 0.221 EXTEND 0.216580 \n", "\n", " per_trade_pnl_pct \n", "0 -0.001907 \n", "1 0.002638 \n", "2 -0.004569 \n", "3 0.002686 \n", "4 -0.001371 \n", "5 0.005334 \n", "6 0.000435 \n", "\n", "[7 rows x 23 columns]" ] }, "execution_count": 120, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_comb_trades" ] }, { "cell_type": "code", "execution_count": 116, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "timestamp_ts_ext=%{x}
per_trade_pnl=%{y}", "legendgroup": "", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "", "orientation": "v", "showlegend": false, "type": "scatter", "x": [ "2026-04-30T09:10:12.149000", "2026-04-30T13:59:15.023000", "2026-04-30T16:00:02.415000", "2026-04-30T16:00:02.415000", "2026-04-30T19:11:23.505000", "2026-04-30T21:49:32.034000", "2026-04-30T23:03:53.771000" ], "xaxis": "x", "y": { "bdata": "bS+QoPgxAcA3wZaQD3rWP3d6VPzfMRPAQMD4hsJnwz/J3olZL4bkP+wKtDukGNE/gd17uOS4yz8=", "dtype": "f8" }, "yaxis": "y" } ], "layout": { "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#f2f5fa" }, "error_y": { "color": "#f2f5fa" }, "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "rgb(17,17,17)", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "baxis": { "endlinecolor": "#A2B1C6", "gridcolor": "#506784", "linecolor": "#506784", "minorgridcolor": "#506784", "startlinecolor": "#A2B1C6" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "line": { "color": "#283442" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "line": { "color": "#283442" } }, "type": "scattergl" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#506784" }, "line": { "color": "rgb(17,17,17)" } }, "header": { "fill": { "color": "#2a3f5f" }, "line": { "color": "rgb(17,17,17)" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#f2f5fa", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#f2f5fa" }, "geo": { "bgcolor": "rgb(17,17,17)", "lakecolor": "rgb(17,17,17)", "landcolor": "rgb(17,17,17)", "showlakes": true, "showland": true, "subunitcolor": "#506784" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "dark" }, "paper_bgcolor": "rgb(17,17,17)", "plot_bgcolor": "rgb(17,17,17)", "polar": { "angularaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "radialaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "yaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" }, "zaxis": { "backgroundcolor": "rgb(17,17,17)", "gridcolor": "#506784", "gridwidth": 2, "linecolor": "#506784", "showbackground": true, "ticks": "", "zerolinecolor": "#C8D4E3" } }, "shapedefaults": { "line": { "color": "#f2f5fa" } }, "sliderdefaults": { "bgcolor": "#C8D4E3", "bordercolor": "rgb(17,17,17)", "borderwidth": 1, "tickwidth": 0 }, "ternary": { "aaxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "baxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" }, "bgcolor": "rgb(17,17,17)", "caxis": { "gridcolor": "#506784", "linecolor": "#506784", "ticks": "" } }, "title": { "x": 0.05 }, "updatemenudefaults": { "bgcolor": "#506784", "borderwidth": 0 }, "xaxis": { "automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "#283442", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "#283442", "linecolor": "#506784", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "#283442", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "timestamp_ts_ext" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "per_trade_pnl" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "px.line(df_comb_trades, x='timestamp_ts_ext', y='per_trade_pnl', template='plotly_dark')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "1827a1ca", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "a0380428", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "bf5e2eaa", "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.13" } }, "nbformat": 4, "nbformat_minor": 5 }