diff --git a/docs/source/notebooks/1. Getting Started with Data Sources.ipynb b/docs/source/notebooks/1. Getting Started with Data Sources.ipynb index a8445f6..2fe8fb6 100644 --- a/docs/source/notebooks/1. Getting Started with Data Sources.ipynb +++ b/docs/source/notebooks/1. Getting Started with Data Sources.ipynb @@ -29,15 +29,220 @@ "name": "stdout", "output_type": "stream", "text": [ - "Loading bar data...\n", - "[*********************100%***********************] 2 of 2 completed\n", - "Loaded bar data: 0:00:03 \n" + "Loading bar data...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\r", + "[ 0%% ]\r", + "[*********************100%%**********************] 2 of 2 completed" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loaded bar data: 0:00:01 \n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" ] }, { "data": { - "text/plain": " date symbol open high low close \\\n0 2021-03-01 AAPL 123.750000 127.930000 122.790001 127.790001 \n1 2021-03-01 MSFT 235.899994 237.470001 233.149994 236.940002 \n2 2021-03-02 AAPL 128.410004 128.720001 125.010002 125.120003 \n3 2021-03-02 MSFT 237.009995 237.300003 233.449997 233.869995 \n4 2021-03-03 AAPL 124.809998 125.709999 121.839996 122.059998 \n.. ... ... ... ... ... ... \n501 2022-02-24 MSFT 272.510010 295.160004 271.519989 294.589996 \n502 2022-02-25 AAPL 163.839996 165.119995 160.869995 164.850006 \n503 2022-02-25 MSFT 295.140015 297.630005 291.649994 297.309998 \n504 2022-02-28 AAPL 163.059998 165.419998 162.429993 165.119995 \n505 2022-02-28 MSFT 294.309998 299.140015 293.000000 298.790009 \n\n volume adj_close \n0 116307900 125.925606 \n1 25324000 232.234665 \n2 102260900 123.294548 \n3 22812500 229.225632 \n4 112966300 120.279190 \n.. ... ... \n501 56989700 291.091705 \n502 91974200 163.410416 \n503 32546700 293.779419 \n504 95056600 163.678055 \n505 34627500 295.241821 \n\n[506 rows x 8 columns]", - "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
datesymbolopenhighlowclosevolumeadj_close
02021-03-01AAPL123.750000127.930000122.790001127.790001116307900125.925606
12021-03-01MSFT235.899994237.470001233.149994236.94000225324000232.234665
22021-03-02AAPL128.410004128.720001125.010002125.120003102260900123.294548
32021-03-02MSFT237.009995237.300003233.449997233.86999522812500229.225632
42021-03-03AAPL124.809998125.709999121.839996122.059998112966300120.279190
...........................
5012022-02-24MSFT272.510010295.160004271.519989294.58999656989700291.091705
5022022-02-25AAPL163.839996165.119995160.869995164.85000691974200163.410416
5032022-02-25MSFT295.140015297.630005291.649994297.30999832546700293.779419
5042022-02-28AAPL163.059998165.419998162.429993165.11999595056600163.678055
5052022-02-28MSFT294.309998299.140015293.000000298.79000934627500295.241821
\n

506 rows × 8 columns

\n
" + "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", + "
datesymbolopenhighlowclosevolumeadj_close
02021-03-01AAPL123.750000127.930000122.790001127.790001116307900125.599648
12021-03-01MSFT235.899994237.470001233.149994236.94000225324000230.847687
22021-03-02AAPL128.410004128.720001125.010002125.120003102260900122.975418
32021-03-02MSFT237.009995237.300003233.449997233.86999522812500227.856644
42021-03-03AAPL124.809998125.709999121.839996122.059998112966300119.967857
...........................
5012022-02-24MSFT272.510010295.160004271.519989294.58999656989700289.353210
5022022-02-25AAPL163.839996165.119995160.869995164.85000691974200162.987427
5032022-02-25MSFT295.140015297.630005291.649994297.30999832546700292.024902
5042022-02-28AAPL163.059998165.419998162.429993165.11999595056600163.254364
5052022-02-28MSFT294.309998299.140015293.000000298.79000934627500293.478577
\n", + "

506 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " date symbol open high low close \\\n", + "0 2021-03-01 AAPL 123.750000 127.930000 122.790001 127.790001 \n", + "1 2021-03-01 MSFT 235.899994 237.470001 233.149994 236.940002 \n", + "2 2021-03-02 AAPL 128.410004 128.720001 125.010002 125.120003 \n", + "3 2021-03-02 MSFT 237.009995 237.300003 233.449997 233.869995 \n", + "4 2021-03-03 AAPL 124.809998 125.709999 121.839996 122.059998 \n", + ".. ... ... ... ... ... ... \n", + "501 2022-02-24 MSFT 272.510010 295.160004 271.519989 294.589996 \n", + "502 2022-02-25 AAPL 163.839996 165.119995 160.869995 164.850006 \n", + "503 2022-02-25 MSFT 295.140015 297.630005 291.649994 297.309998 \n", + "504 2022-02-28 AAPL 163.059998 165.419998 162.429993 165.119995 \n", + "505 2022-02-28 MSFT 294.309998 299.140015 293.000000 298.790009 \n", + "\n", + " volume adj_close \n", + "0 116307900 125.599648 \n", + "1 25324000 230.847687 \n", + "2 102260900 122.975418 \n", + "3 22812500 227.856644 \n", + "4 112966300 119.967857 \n", + ".. ... ... \n", + "501 56989700 289.353210 \n", + "502 91974200 162.987427 \n", + "503 32546700 292.024902 \n", + "504 95056600 163.254364 \n", + "505 34627500 293.478577 \n", + "\n", + "[506 rows x 8 columns]" + ] }, "execution_count": 1, "metadata": {}, @@ -77,7 +282,9 @@ "outputs": [ { "data": { - "text/plain": "" + "text/plain": [ + "" + ] }, "execution_count": 2, "metadata": {}, @@ -113,15 +320,218 @@ "name": "stdout", "output_type": "stream", "text": [ - "Loading bar data...\n", - "[*********************100%***********************] 2 of 2 completed\n", - "Loaded bar data: 0:00:01 \n" + "Loading bar data...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "[*********************100%%**********************] 2 of 2 completed" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loaded bar data: 0:00:00 \n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" ] }, { "data": { - "text/plain": " date symbol open high low close \\\n0 2021-03-01 IBM 115.057358 116.940727 114.588913 115.430206 \n1 2021-03-01 TSLA 230.036667 239.666672 228.350006 239.476669 \n2 2021-03-02 IBM 115.430206 116.539200 114.971321 115.038239 \n3 2021-03-02 TSLA 239.426666 240.369995 228.333328 228.813339 \n4 2021-03-03 IBM 115.200768 117.237091 114.703636 116.978966 \n.. ... ... ... ... ... ... \n501 2022-02-24 TSLA 233.463333 267.493347 233.333328 266.923340 \n502 2022-02-25 IBM 122.050003 124.260002 121.449997 124.180000 \n503 2022-02-25 TSLA 269.743347 273.166656 260.799988 269.956665 \n504 2022-02-28 IBM 122.209999 123.389999 121.040001 122.510002 \n505 2022-02-28 TSLA 271.670013 292.286682 271.570007 290.143341 \n\n volume adj_close \n0 5977367 102.232941 \n1 81408600 239.476669 \n2 4732418 101.885780 \n3 71196600 228.813339 \n4 7744898 103.604614 \n.. ... ... \n501 135322200 266.923340 \n502 4460900 115.365776 \n503 76067700 269.956665 \n504 6757300 113.814316 \n505 99006900 290.143341 \n\n[506 rows x 8 columns]", - "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
datesymbolopenhighlowclosevolumeadj_close
02021-03-01IBM115.057358116.940727114.588913115.4302065977367102.232941
12021-03-01TSLA230.036667239.666672228.350006239.47666981408600239.476669
22021-03-02IBM115.430206116.539200114.971321115.0382394732418101.885780
32021-03-02TSLA239.426666240.369995228.333328228.81333971196600228.813339
42021-03-03IBM115.200768117.237091114.703636116.9789667744898103.604614
...........................
5012022-02-24TSLA233.463333267.493347233.333328266.923340135322200266.923340
5022022-02-25IBM122.050003124.260002121.449997124.1800004460900115.365776
5032022-02-25TSLA269.743347273.166656260.799988269.95666576067700269.956665
5042022-02-28IBM122.209999123.389999121.040001122.5100026757300113.814316
5052022-02-28TSLA271.670013292.286682271.570007290.14334199006900290.143341
\n

506 rows × 8 columns

\n
" + "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", + "
datesymbolopenhighlowclosevolumeadj_close
02021-03-01IBM115.057358116.940727114.588913115.4302065977367100.173233
12021-03-01TSLA230.036667239.666672228.350006239.47666981408600239.476669
22021-03-02IBM115.430206116.539200114.971321115.038239473241899.833076
32021-03-02TSLA239.426666240.369995228.333328228.81333971196600228.813339
42021-03-03IBM115.200768117.237091114.703636116.9789667744898101.517296
...........................
5012022-02-24TSLA233.463333267.493347233.333328266.923340135322200266.923340
5022022-02-25IBM122.050003124.260002121.449997124.1800004460900113.041489
5032022-02-25TSLA269.743347273.166656260.799988269.95666576067700269.956665
5042022-02-28IBM122.209999123.389999121.040001122.5100026757300111.521286
5052022-02-28TSLA271.670013292.286682271.570007290.14334199006900290.143341
\n", + "

506 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " date symbol open high low close \\\n", + "0 2021-03-01 IBM 115.057358 116.940727 114.588913 115.430206 \n", + "1 2021-03-01 TSLA 230.036667 239.666672 228.350006 239.476669 \n", + "2 2021-03-02 IBM 115.430206 116.539200 114.971321 115.038239 \n", + "3 2021-03-02 TSLA 239.426666 240.369995 228.333328 228.813339 \n", + "4 2021-03-03 IBM 115.200768 117.237091 114.703636 116.978966 \n", + ".. ... ... ... ... ... ... \n", + "501 2022-02-24 TSLA 233.463333 267.493347 233.333328 266.923340 \n", + "502 2022-02-25 IBM 122.050003 124.260002 121.449997 124.180000 \n", + "503 2022-02-25 TSLA 269.743347 273.166656 260.799988 269.956665 \n", + "504 2022-02-28 IBM 122.209999 123.389999 121.040001 122.510002 \n", + "505 2022-02-28 TSLA 271.670013 292.286682 271.570007 290.143341 \n", + "\n", + " volume adj_close \n", + "0 5977367 100.173233 \n", + "1 81408600 239.476669 \n", + "2 4732418 99.833076 \n", + "3 71196600 228.813339 \n", + "4 7744898 101.517296 \n", + ".. ... ... \n", + "501 135322200 266.923340 \n", + "502 4460900 113.041489 \n", + "503 76067700 269.956665 \n", + "504 6757300 111.521286 \n", + "505 99006900 290.143341 \n", + "\n", + "[506 rows x 8 columns]" + ] }, "execution_count": 3, "metadata": {}, @@ -155,13 +565,197 @@ "name": "stdout", "output_type": "stream", "text": [ - "Loaded cached bar data.\n" + "Loaded cached bar data.\n", + "\n" ] }, { "data": { - "text/plain": " date symbol open high low close \\\n0 2021-03-01 IBM 115.057358 116.940727 114.588913 115.430206 \n1 2021-03-02 IBM 115.430206 116.539200 114.971321 115.038239 \n2 2021-03-03 IBM 115.200768 117.237091 114.703636 116.978966 \n3 2021-03-04 IBM 116.634796 117.801147 113.537285 114.827919 \n4 2021-03-05 IBM 115.334610 118.307838 114.961761 117.428299 \n.. ... ... ... ... ... ... \n248 2022-02-22 TSLA 278.043335 285.576660 267.033325 273.843323 \n249 2022-02-23 TSLA 276.809998 278.433319 253.520004 254.679993 \n250 2022-02-24 TSLA 233.463333 267.493347 233.333328 266.923340 \n251 2022-02-25 TSLA 269.743347 273.166656 260.799988 269.956665 \n252 2022-02-28 TSLA 271.670013 292.286682 271.570007 290.143341 \n\n volume adj_close \n0 5977367 102.232941 \n1 4732418 101.885780 \n2 7744898 103.604614 \n3 8439651 101.699509 \n4 7268968 104.002579 \n.. ... ... \n248 83288100 273.843323 \n249 95256900 254.679993 \n250 135322200 266.923340 \n251 76067700 269.956665 \n252 99006900 290.143341 \n\n[506 rows x 8 columns]", - "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
datesymbolopenhighlowclosevolumeadj_close
02021-03-01IBM115.057358116.940727114.588913115.4302065977367102.232941
12021-03-02IBM115.430206116.539200114.971321115.0382394732418101.885780
22021-03-03IBM115.200768117.237091114.703636116.9789667744898103.604614
32021-03-04IBM116.634796117.801147113.537285114.8279198439651101.699509
42021-03-05IBM115.334610118.307838114.961761117.4282997268968104.002579
...........................
2482022-02-22TSLA278.043335285.576660267.033325273.84332383288100273.843323
2492022-02-23TSLA276.809998278.433319253.520004254.67999395256900254.679993
2502022-02-24TSLA233.463333267.493347233.333328266.923340135322200266.923340
2512022-02-25TSLA269.743347273.166656260.799988269.95666576067700269.956665
2522022-02-28TSLA271.670013292.286682271.570007290.14334199006900290.143341
\n

506 rows × 8 columns

\n
" + "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", + "
datesymbolopenhighlowclosevolumeadj_close
02021-03-01IBM115.057358116.940727114.588913115.4302065977367100.173233
12021-03-02IBM115.430206116.539200114.971321115.038239473241899.833076
22021-03-03IBM115.200768117.237091114.703636116.9789667744898101.517296
32021-03-04IBM116.634796117.801147113.537285114.827919843965199.650558
42021-03-05IBM115.334610118.307838114.961761117.4282997268968101.907227
...........................
2482022-02-22TSLA278.043335285.576660267.033325273.84332383288100273.843323
2492022-02-23TSLA276.809998278.433319253.520004254.67999395256900254.679993
2502022-02-24TSLA233.463333267.493347233.333328266.923340135322200266.923340
2512022-02-25TSLA269.743347273.166656260.799988269.95666576067700269.956665
2522022-02-28TSLA271.670013292.286682271.570007290.14334199006900290.143341
\n", + "

506 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " date symbol open high low close \\\n", + "0 2021-03-01 IBM 115.057358 116.940727 114.588913 115.430206 \n", + "1 2021-03-02 IBM 115.430206 116.539200 114.971321 115.038239 \n", + "2 2021-03-03 IBM 115.200768 117.237091 114.703636 116.978966 \n", + "3 2021-03-04 IBM 116.634796 117.801147 113.537285 114.827919 \n", + "4 2021-03-05 IBM 115.334610 118.307838 114.961761 117.428299 \n", + ".. ... ... ... ... ... ... \n", + "248 2022-02-22 TSLA 278.043335 285.576660 267.033325 273.843323 \n", + "249 2022-02-23 TSLA 276.809998 278.433319 253.520004 254.679993 \n", + "250 2022-02-24 TSLA 233.463333 267.493347 233.333328 266.923340 \n", + "251 2022-02-25 TSLA 269.743347 273.166656 260.799988 269.956665 \n", + "252 2022-02-28 TSLA 271.670013 292.286682 271.570007 290.143341 \n", + "\n", + " volume adj_close \n", + "0 5977367 100.173233 \n", + "1 4732418 99.833076 \n", + "2 7744898 101.517296 \n", + "3 8439651 99.650558 \n", + "4 7268968 101.907227 \n", + ".. ... ... \n", + "248 83288100 273.843323 \n", + "249 95256900 254.679993 \n", + "250 135322200 266.923340 \n", + "251 76067700 269.956665 \n", + "252 99006900 290.143341 \n", + "\n", + "[506 rows x 8 columns]" + ] }, "execution_count": 4, "metadata": {}, @@ -279,13 +873,197 @@ "output_type": "stream", "text": [ "Loading bar data...\n", - "Loaded bar data: 0:00:46 \n" + "Loaded bar data: 0:00:05 \n", + "\n" ] }, { "data": { - "text/plain": " date symbol open high low close \\\n0 2021-03-01 04:00:00-05:00 AAPL 124.30 124.56 124.30 124.50 \n1 2021-03-01 04:00:00-05:00 MSFT 235.87 236.00 235.87 236.00 \n2 2021-03-01 04:01:00-05:00 AAPL 124.56 124.60 124.30 124.30 \n3 2021-03-01 04:01:00-05:00 MSFT 236.17 236.17 236.17 236.17 \n4 2021-03-01 04:02:00-05:00 AAPL 124.00 124.05 123.78 123.78 \n... ... ... ... ... ... ... \n33859 2021-03-31 19:57:00-04:00 MSFT 237.28 237.28 237.28 237.28 \n33860 2021-03-31 19:58:00-04:00 AAPL 122.36 122.39 122.33 122.39 \n33861 2021-03-31 19:58:00-04:00 MSFT 237.40 237.40 237.35 237.35 \n33862 2021-03-31 19:59:00-04:00 AAPL 122.39 122.45 122.38 122.45 \n33863 2021-03-31 19:59:00-04:00 MSFT 237.40 237.53 237.40 237.53 \n\n volume vwap \n0 12267.0 124.433365 \n1 1429.0 235.938887 \n2 9439.0 124.481323 \n3 104.0 236.161538 \n4 4834.0 123.935583 \n... ... ... \n33859 507.0 237.367870 \n33860 3403.0 122.360544 \n33861 636.0 237.378066 \n33862 5560.0 122.402606 \n33863 1163.0 237.473801 \n\n[33864 rows x 8 columns]", - "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
datesymbolopenhighlowclosevolumevwap
02021-03-01 04:00:00-05:00AAPL124.30124.56124.30124.5012267.0124.433365
12021-03-01 04:00:00-05:00MSFT235.87236.00235.87236.001429.0235.938887
22021-03-01 04:01:00-05:00AAPL124.56124.60124.30124.309439.0124.481323
32021-03-01 04:01:00-05:00MSFT236.17236.17236.17236.17104.0236.161538
42021-03-01 04:02:00-05:00AAPL124.00124.05123.78123.784834.0123.935583
...........................
338592021-03-31 19:57:00-04:00MSFT237.28237.28237.28237.28507.0237.367870
338602021-03-31 19:58:00-04:00AAPL122.36122.39122.33122.393403.0122.360544
338612021-03-31 19:58:00-04:00MSFT237.40237.40237.35237.35636.0237.378066
338622021-03-31 19:59:00-04:00AAPL122.39122.45122.38122.455560.0122.402606
338632021-03-31 19:59:00-04:00MSFT237.40237.53237.40237.531163.0237.473801
\n

33864 rows × 8 columns

\n
" + "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", + "
datesymbolopenhighlowclosevolumevwap
02021-03-01 04:00:00-05:00AAPL124.30124.56124.30124.5012267.0124.433365
12021-03-01 04:00:00-05:00MSFT235.87236.00235.87236.001429.0235.938887
22021-03-01 04:01:00-05:00AAPL124.56124.60124.30124.309439.0124.481323
32021-03-01 04:01:00-05:00MSFT236.17236.17236.17236.17104.0236.161538
42021-03-01 04:02:00-05:00AAPL124.00124.05123.78123.784834.0123.935583
...........................
333402021-03-31 19:57:00-04:00MSFT237.28237.28237.28237.28507.0237.367870
333412021-03-31 19:58:00-04:00AAPL122.36122.39122.33122.393403.0122.360544
333422021-03-31 19:58:00-04:00MSFT237.40237.40237.35237.35636.0237.378066
333432021-03-31 19:59:00-04:00AAPL122.39122.45122.38122.455560.0122.402606
333442021-03-31 19:59:00-04:00MSFT237.40237.53237.40237.531163.0237.473801
\n", + "

33345 rows × 8 columns

\n", + "
" + ], + "text/plain": [ + " date symbol open high low close \\\n", + "0 2021-03-01 04:00:00-05:00 AAPL 124.30 124.56 124.30 124.50 \n", + "1 2021-03-01 04:00:00-05:00 MSFT 235.87 236.00 235.87 236.00 \n", + "2 2021-03-01 04:01:00-05:00 AAPL 124.56 124.60 124.30 124.30 \n", + "3 2021-03-01 04:01:00-05:00 MSFT 236.17 236.17 236.17 236.17 \n", + "4 2021-03-01 04:02:00-05:00 AAPL 124.00 124.05 123.78 123.78 \n", + "... ... ... ... ... ... ... \n", + "33340 2021-03-31 19:57:00-04:00 MSFT 237.28 237.28 237.28 237.28 \n", + "33341 2021-03-31 19:58:00-04:00 AAPL 122.36 122.39 122.33 122.39 \n", + "33342 2021-03-31 19:58:00-04:00 MSFT 237.40 237.40 237.35 237.35 \n", + "33343 2021-03-31 19:59:00-04:00 AAPL 122.39 122.45 122.38 122.45 \n", + "33344 2021-03-31 19:59:00-04:00 MSFT 237.40 237.53 237.40 237.53 \n", + "\n", + " volume vwap \n", + "0 12267.0 124.433365 \n", + "1 1429.0 235.938887 \n", + "2 9439.0 124.481323 \n", + "3 104.0 236.161538 \n", + "4 4834.0 123.935583 \n", + "... ... ... \n", + "33340 507.0 237.367870 \n", + "33341 3403.0 122.360544 \n", + "33342 636.0 237.378066 \n", + "33343 5560.0 122.402606 \n", + "33344 1163.0 237.473801 \n", + "\n", + "[33345 rows x 8 columns]" + ] }, "execution_count": 8, "metadata": {}, @@ -327,18 +1105,40 @@ "name": "stdout", "output_type": "stream", "text": [ - "Loading bar data...\n", - "Loaded bar data: 0:00:02 \n" + "Loading bar data...\n" ] }, { - "data": { - "text/plain": " symbol date open high low \\\n0 BTC/USD 2021-01-01 01:00:00-05:00 29255.71 29338.25 29153.55 \n1 BTC/USD 2021-01-01 02:00:00-05:00 29235.61 29236.95 28905.00 \n2 BTC/USD 2021-01-01 03:00:00-05:00 29162.50 29248.52 28948.86 \n3 BTC/USD 2021-01-01 04:00:00-05:00 29075.31 29372.32 29058.05 \n4 BTC/USD 2021-01-01 05:00:00-05:00 29291.54 29400.00 29232.16 \n.. ... ... ... ... ... \n731 BTC/USD 2021-01-31 15:00:00-05:00 32837.67 32964.87 32528.54 \n732 BTC/USD 2021-01-31 16:00:00-05:00 32889.01 32935.98 32554.59 \n733 BTC/USD 2021-01-31 17:00:00-05:00 32599.00 33126.32 32599.00 \n734 BTC/USD 2021-01-31 18:00:00-05:00 33000.00 33263.94 32957.10 \n735 BTC/USD 2021-01-31 19:00:00-05:00 33134.03 33134.03 32303.44 \n\n close volume vwap trade_count \n0 29234.15 42.244289 29237.240312 1243.0 \n1 29162.50 34.506038 29078.423185 1070.0 \n2 29076.77 27.596804 29091.465155 1110.0 \n3 29284.92 20.694200 29248.730924 880.0 \n4 29286.63 16.617646 29338.609132 742.0 \n.. ... ... ... ... \n731 32882.87 40.631122 32818.132855 2197.0 \n732 32586.68 26.673190 32737.975296 1625.0 \n733 32998.35 25.422568 32923.438893 1770.0 \n734 33134.86 31.072017 33147.086803 2203.0 \n735 32572.03 60.460424 32552.937863 2665.0 \n\n[736 rows x 9 columns]", - "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
symboldateopenhighlowclosevolumevwaptrade_count
0BTC/USD2021-01-01 01:00:00-05:0029255.7129338.2529153.5529234.1542.24428929237.2403121243.0
1BTC/USD2021-01-01 02:00:00-05:0029235.6129236.9528905.0029162.5034.50603829078.4231851070.0
2BTC/USD2021-01-01 03:00:00-05:0029162.5029248.5228948.8629076.7727.59680429091.4651551110.0
3BTC/USD2021-01-01 04:00:00-05:0029075.3129372.3229058.0529284.9220.69420029248.730924880.0
4BTC/USD2021-01-01 05:00:00-05:0029291.5429400.0029232.1629286.6316.61764629338.609132742.0
..............................
731BTC/USD2021-01-31 15:00:00-05:0032837.6732964.8732528.5432882.8740.63112232818.1328552197.0
732BTC/USD2021-01-31 16:00:00-05:0032889.0132935.9832554.5932586.6826.67319032737.9752961625.0
733BTC/USD2021-01-31 17:00:00-05:0032599.0033126.3232599.0032998.3525.42256832923.4388931770.0
734BTC/USD2021-01-31 18:00:00-05:0033000.0033263.9432957.1033134.8631.07201733147.0868032203.0
735BTC/USD2021-01-31 19:00:00-05:0033134.0333134.0332303.4432572.0360.46042432552.9378632665.0
\n

736 rows × 9 columns

\n
" - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[9], line 7\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpybroker\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AlpacaCrypto\n\u001b[1;32m 3\u001b[0m crypto \u001b[38;5;241m=\u001b[39m AlpacaCrypto(\n\u001b[1;32m 4\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mALPACA_API_KEY\u001b[39m\u001b[38;5;124m'\u001b[39m], \n\u001b[1;32m 5\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mALPACA_API_SECRET\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 6\u001b[0m )\n\u001b[0;32m----> 7\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mcrypto\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mquery\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mBTC/USD\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart_date\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m1/1/2021\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mend_date\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m2/1/2021\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeframe\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m1h\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m df\n", + "File \u001b[0;32m~/pybroker/src/pybroker/data.py:426\u001b[0m, in \u001b[0;36mAlpacaCrypto.query\u001b[0;34m(self, symbols, start_date, end_date, timeframe, _)\u001b[0m\n\u001b[1;32m 417\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mquery\u001b[39m(\n\u001b[1;32m 418\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 419\u001b[0m symbols: Union[\u001b[38;5;28mstr\u001b[39m, Iterable[\u001b[38;5;28mstr\u001b[39m]],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 423\u001b[0m _: Optional[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 424\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame:\n\u001b[1;32m 425\u001b[0m _parse_alpaca_timeframe(timeframe)\n\u001b[0;32m--> 426\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mquery\u001b[49m\u001b[43m(\u001b[49m\u001b[43msymbols\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart_date\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mend_date\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeframe\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/pybroker/src/pybroker/data.py:229\u001b[0m, in \u001b[0;36mDataSource.query\u001b[0;34m(self, symbols, start_date, end_date, timeframe, adjust)\u001b[0m\n\u001b[1;32m 222\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_logger\u001b[38;5;241m.\u001b[39mdownload_bar_data_start()\n\u001b[1;32m 223\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_logger\u001b[38;5;241m.\u001b[39minfo_download_bar_data_start(\n\u001b[1;32m 224\u001b[0m symbols\u001b[38;5;241m=\u001b[39muncached_syms,\n\u001b[1;32m 225\u001b[0m timeframe\u001b[38;5;241m=\u001b[39mtimeframe,\n\u001b[1;32m 226\u001b[0m start_date\u001b[38;5;241m=\u001b[39mstart_date,\n\u001b[1;32m 227\u001b[0m end_date\u001b[38;5;241m=\u001b[39mend_date,\n\u001b[1;32m 228\u001b[0m )\n\u001b[0;32m--> 229\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_fetch_data\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 230\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mfrozenset\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43muncached_syms\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart_date\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mend_date\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeframe\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43madjust\u001b[49m\n\u001b[1;32m 231\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 232\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 233\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_scope\u001b[38;5;241m.\u001b[39mdata_source_cache \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 234\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m cached_df\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mempty\n\u001b[1;32m 235\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mset\u001b[39m(cached_df\u001b[38;5;241m.\u001b[39mcolumns) \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mset\u001b[39m(df\u001b[38;5;241m.\u001b[39mcolumns)\n\u001b[1;32m 236\u001b[0m ):\n\u001b[1;32m 237\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_logger\u001b[38;5;241m.\u001b[39minfo_invalidate_data_source_cache()\n", + "File \u001b[0;32m~/pybroker/src/pybroker/data.py:445\u001b[0m, in \u001b[0;36mAlpacaCrypto._fetch_data\u001b[0;34m(self, symbols, start_date, end_date, timeframe, _)\u001b[0m\n\u001b[1;32m 437\u001b[0m amount, unit \u001b[38;5;241m=\u001b[39m _parse_alpaca_timeframe(timeframe)\n\u001b[1;32m 438\u001b[0m request \u001b[38;5;241m=\u001b[39m CryptoBarsRequest(\n\u001b[1;32m 439\u001b[0m symbol_or_symbols\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mlist\u001b[39m(symbols),\n\u001b[1;32m 440\u001b[0m start\u001b[38;5;241m=\u001b[39mstart_date,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 443\u001b[0m limit\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 444\u001b[0m )\n\u001b[0;32m--> 445\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_api\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_crypto_bars\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mdf \u001b[38;5;66;03m# type: ignore[union-attr]\u001b[39;00m\n\u001b[1;32m 446\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m df\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mempty:\n\u001b[1;32m 447\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m pd\u001b[38;5;241m.\u001b[39mDataFrame(columns\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mCOLUMNS)\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/alpaca/data/historical/crypto.py:88\u001b[0m, in \u001b[0;36mCryptoHistoricalDataClient.get_crypto_bars\u001b[0;34m(self, request_params, feed)\u001b[0m\n\u001b[1;32m 85\u001b[0m params \u001b[38;5;241m=\u001b[39m request_params\u001b[38;5;241m.\u001b[39mto_request_fields()\n\u001b[1;32m 87\u001b[0m \u001b[38;5;66;03m# paginated get request for crypto market data api\u001b[39;00m\n\u001b[0;32m---> 88\u001b[0m raw_bars \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data_get\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 89\u001b[0m \u001b[43m \u001b[49m\u001b[43mendpoint_asset_class\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcrypto\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 90\u001b[0m \u001b[43m \u001b[49m\u001b[43mendpoint_data_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mbars\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 91\u001b[0m \u001b[43m \u001b[49m\u001b[43mapi_version\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mv1beta3\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 92\u001b[0m \u001b[43m \u001b[49m\u001b[43mfeed\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfeed\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 93\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 94\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_use_raw_data:\n\u001b[1;32m 97\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m raw_bars\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/alpaca/data/historical/crypto.py:357\u001b[0m, in \u001b[0;36mCryptoHistoricalDataClient._data_get\u001b[0;34m(self, endpoint_asset_class, endpoint_data_type, api_version, feed, symbol_or_symbols, limit, page_limit, extension, **kwargs)\u001b[0m\n\u001b[1;32m 354\u001b[0m params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlimit\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m actual_limit\n\u001b[1;32m 355\u001b[0m params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpage_token\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m page_token\n\u001b[0;32m--> 357\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mapi_version\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mapi_version\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 359\u001b[0m \u001b[38;5;66;03m# TODO: Merge parsing if possible\u001b[39;00m\n\u001b[1;32m 360\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 361\u001b[0m extension \u001b[38;5;241m==\u001b[39m DataExtensionType\u001b[38;5;241m.\u001b[39mLATEST\n\u001b[1;32m 362\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m extension \u001b[38;5;241m==\u001b[39m DataExtensionType\u001b[38;5;241m.\u001b[39mSNAPSHOT\n\u001b[1;32m 363\u001b[0m ):\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/alpaca/common/rest.py:221\u001b[0m, in \u001b[0;36mRESTClient.get\u001b[0;34m(self, path, data, **kwargs)\u001b[0m\n\u001b[1;32m 210\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(\u001b[38;5;28mself\u001b[39m, path: \u001b[38;5;28mstr\u001b[39m, data: Union[\u001b[38;5;28mdict\u001b[39m, \u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m HTTPResult:\n\u001b[1;32m 211\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Performs a single GET request\u001b[39;00m\n\u001b[1;32m 212\u001b[0m \n\u001b[1;32m 213\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;124;03m dict: The response\u001b[39;00m\n\u001b[1;32m 220\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 221\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mGET\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/alpaca/common/rest.py:129\u001b[0m, in \u001b[0;36mRESTClient._request\u001b[0;34m(self, method, path, data, base_url, api_version)\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m retry \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 129\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_one_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mretry\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 130\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m RetryException:\n\u001b[1;32m 131\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_retry_wait)\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/alpaca/common/rest.py:193\u001b[0m, in \u001b[0;36mRESTClient._one_request\u001b[0;34m(self, method, url, opts, retry)\u001b[0m\n\u001b[1;32m 174\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_one_request\u001b[39m(\u001b[38;5;28mself\u001b[39m, method: \u001b[38;5;28mstr\u001b[39m, url: \u001b[38;5;28mstr\u001b[39m, opts: \u001b[38;5;28mdict\u001b[39m, retry: \u001b[38;5;28mint\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mdict\u001b[39m:\n\u001b[1;32m 175\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Perform one request, possibly raising RetryException in the case\u001b[39;00m\n\u001b[1;32m 176\u001b[0m \u001b[38;5;124;03m the response is 429. Otherwise, if error text contain \"code\" string,\u001b[39;00m\n\u001b[1;32m 177\u001b[0m \u001b[38;5;124;03m then it decodes to json object and returns APIError.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 191\u001b[0m \u001b[38;5;124;03m dict: The response data\u001b[39;00m\n\u001b[1;32m 192\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 193\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_session\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mopts\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 195\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 196\u001b[0m response\u001b[38;5;241m.\u001b[39mraise_for_status()\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/requests/adapters.py:486\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 483\u001b[0m timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 485\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 486\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 487\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 488\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 489\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 490\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 491\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 492\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 493\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 494\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 495\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 496\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 497\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 498\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 501\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:703\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 700\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_proxy(conn)\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Make the request on the httplib connection object.\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 704\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 706\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 707\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 708\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 709\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 710\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 711\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 713\u001b[0m \u001b[38;5;66;03m# If we're going to release the connection in ``finally:``, then\u001b[39;00m\n\u001b[1;32m 714\u001b[0m \u001b[38;5;66;03m# the response doesn't need to know about the connection. Otherwise\u001b[39;00m\n\u001b[1;32m 715\u001b[0m \u001b[38;5;66;03m# it will also try to release it and we'll have a double-release\u001b[39;00m\n\u001b[1;32m 716\u001b[0m \u001b[38;5;66;03m# mess.\u001b[39;00m\n\u001b[1;32m 717\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:449\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 444\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m conn\u001b[38;5;241m.\u001b[39mgetresponse()\n\u001b[1;32m 445\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# Remove the TypeError from the exception chain in\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# Python 3 (including for exceptions like SystemExit).\u001b[39;00m\n\u001b[1;32m 448\u001b[0m \u001b[38;5;66;03m# Otherwise it looks like a bug in the code.\u001b[39;00m\n\u001b[0;32m--> 449\u001b[0m \u001b[43msix\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_from\u001b[49m\u001b[43m(\u001b[49m\u001b[43me\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 450\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError, SocketError) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 451\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_timeout(err\u001b[38;5;241m=\u001b[39me, url\u001b[38;5;241m=\u001b[39murl, timeout_value\u001b[38;5;241m=\u001b[39mread_timeout)\n", + "File \u001b[0;32m:3\u001b[0m, in \u001b[0;36mraise_from\u001b[0;34m(value, from_value)\u001b[0m\n", + "File \u001b[0;32m~/pybroker/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py:444\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 441\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m 442\u001b[0m \u001b[38;5;66;03m# Python 3\u001b[39;00m\n\u001b[1;32m 443\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 444\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 445\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 446\u001b[0m \u001b[38;5;66;03m# Remove the TypeError from the exception chain in\u001b[39;00m\n\u001b[1;32m 447\u001b[0m \u001b[38;5;66;03m# Python 3 (including for exceptions like SystemExit).\u001b[39;00m\n\u001b[1;32m 448\u001b[0m \u001b[38;5;66;03m# Otherwise it looks like a bug in the code.\u001b[39;00m\n\u001b[1;32m 449\u001b[0m six\u001b[38;5;241m.\u001b[39mraise_from(e, \u001b[38;5;28;01mNone\u001b[39;00m)\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/http/client.py:1377\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1375\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1376\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1377\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1378\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n\u001b[1;32m 1379\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose()\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/http/client.py:320\u001b[0m, in \u001b[0;36mHTTPResponse.begin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 318\u001b[0m \u001b[38;5;66;03m# read until we get a non-100 response\u001b[39;00m\n\u001b[1;32m 319\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 320\u001b[0m version, status, reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 321\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status \u001b[38;5;241m!=\u001b[39m CONTINUE:\n\u001b[1;32m 322\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/http/client.py:281\u001b[0m, in \u001b[0;36mHTTPResponse._read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 280\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_read_status\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 281\u001b[0m line \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreadline\u001b[49m\u001b[43m(\u001b[49m\u001b[43m_MAXLINE\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124miso-8859-1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 282\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(line) \u001b[38;5;241m>\u001b[39m _MAXLINE:\n\u001b[1;32m 283\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LineTooLong(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstatus line\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/socket.py:704\u001b[0m, in \u001b[0;36mSocketIO.readinto\u001b[0;34m(self, b)\u001b[0m\n\u001b[1;32m 702\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 703\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 704\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrecv_into\u001b[49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m timeout:\n\u001b[1;32m 706\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_timeout_occurred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/ssl.py:1242\u001b[0m, in \u001b[0;36mSSLSocket.recv_into\u001b[0;34m(self, buffer, nbytes, flags)\u001b[0m\n\u001b[1;32m 1238\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m flags \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 1239\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 1240\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon-zero flags not allowed in calls to recv_into() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m\n\u001b[1;32m 1241\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m)\n\u001b[0;32m-> 1242\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnbytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1243\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1244\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mrecv_into(buffer, nbytes, flags)\n", + "File \u001b[0;32m~/.asdf/installs/python/3.9.16/lib/python3.9/ssl.py:1100\u001b[0m, in \u001b[0;36mSSLSocket.read\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1098\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1099\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m buffer \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 1100\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sslobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1101\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1102\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mread(\u001b[38;5;28mlen\u001b[39m)\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] } ], "source": [ @@ -372,7 +1172,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "d66daaee", "metadata": { "ExecuteTime": { @@ -380,34 +1180,22 @@ "start_time": "2023-08-15T11:36:25.623249Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loading bar data...\n", - "Loaded bar data: 0:00:01 \n" - ] - }, - { - "data": { - "text/plain": " date symbol open high low close volume\n0 2021-03-01 000001.SZ 21.54 21.68 21.18 21.45 1125387\n1 2021-03-01 600000.SH 10.59 10.64 10.50 10.58 547461\n2 2021-03-02 000001.SZ 21.62 22.15 21.26 21.65 1473425\n3 2021-03-02 600000.SH 10.61 10.70 10.36 10.47 747631\n4 2021-03-03 000001.SZ 21.58 23.08 21.46 23.01 1919635\n.. ... ... ... ... ... ... ...\n969 2023-02-27 600000.SH 7.16 7.20 7.16 7.16 158006\n970 2023-02-28 000001.SZ 13.75 13.85 13.61 13.78 607936\n971 2023-02-28 600000.SH 7.18 7.20 7.14 7.18 174481\n972 2023-03-01 000001.SZ 13.80 14.19 13.74 14.17 1223452\n973 2023-03-01 600000.SH 7.17 7.27 7.17 7.26 256613\n\n[974 rows x 7 columns]", - "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
datesymbolopenhighlowclosevolume
02021-03-01000001.SZ21.5421.6821.1821.451125387
12021-03-01600000.SH10.5910.6410.5010.58547461
22021-03-02000001.SZ21.6222.1521.2621.651473425
32021-03-02600000.SH10.6110.7010.3610.47747631
42021-03-03000001.SZ21.5823.0821.4623.011919635
........................
9692023-02-27600000.SH7.167.207.167.16158006
9702023-02-28000001.SZ13.7513.8513.6113.78607936
9712023-02-28600000.SH7.187.207.147.18174481
9722023-03-01000001.SZ13.8014.1913.7414.171223452
9732023-03-01600000.SH7.177.277.177.26256613
\n

974 rows × 7 columns

\n
" - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from pybroker.ext.data import AKShare\n", "\n", - "# You can set adjust to 'qfq' or 'hfq' to adjust the data, \n", - "# and set timeframe to '1d', '1w', '1mo' to get daily, weekly, monthly data\n", - "akshare = AKShare(adjust=\"\", timeframe=\"1d\")\n", + "akshare = AKShare()\n", "# You can substitute 000001.SZ with 000001, and it will still work!\n", "# and you can set start_date as \"20210301\" format\n", - "df = akshare.query(symbols=['000001.SZ', '600000.SH'], start_date='3/1/2021', end_date='3/1/2023')\n", + "# You can also set adjust to 'qfq' or 'hfq' to adjust the data, \n", + "# and set timeframe to '1d', '1w' to get daily, weekly data\n", + "df = akshare.query(\n", + " symbols=['000001.SZ', '600000.SH'], \n", + " start_date='3/1/2021', \n", + " end_date='3/1/2023',\n", + " adjust=\"\", \n", + " timeframe=\"1d\",\n", + ")\n", "df" ] },