# uncomment to install in colab
# !pip install -e git+https://github.com/enzoampil/fastquant.git@master#egg=fastquant
from fastquant import get_pse_data_cache, get_stock_data
df = get_pse_data_cache()
df.tail()
Symbol | 2GO | AAA | ... | WPI | ZHI | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
open | high | low | close | value | open | high | low | close | value | ... | open | high | low | close | value | open | high | low | close | value | |
dt | |||||||||||||||||||||
2020-06-04 | 9.55 | 9.55 | 9.25 | 9.50 | 859225.0 | NaN | NaN | NaN | NaN | NaN | ... | 0.390 | 0.410 | 0.390 | 0.405 | 139850.0 | 0.150 | 0.150 | 0.147 | 0.147 | 192870.0 |
2020-06-05 | 9.55 | 9.78 | 9.50 | 9.64 | 626673.0 | NaN | NaN | NaN | NaN | NaN | ... | 0.395 | 0.395 | 0.395 | 0.395 | 15800.0 | 0.149 | 0.149 | 0.147 | 0.147 | 53180.0 |
2020-06-08 | 9.65 | 9.65 | 9.40 | 9.51 | 1418976.0 | NaN | NaN | NaN | NaN | NaN | ... | 0.400 | 0.410 | 0.400 | 0.405 | 148750.0 | 0.145 | 0.146 | 0.145 | 0.145 | 37740.0 |
2020-06-09 | 9.55 | 9.80 | 9.55 | 9.80 | 1520175.0 | NaN | NaN | NaN | NaN | NaN | ... | 0.400 | 0.415 | 0.400 | 0.415 | 143350.0 | 0.145 | 0.148 | 0.142 | 0.147 | 84080.0 |
2020-06-10 | 10.30 | 12.20 | 10.00 | 11.50 | 27402032.0 | NaN | NaN | NaN | NaN | NaN | ... | 0.415 | 0.415 | 0.400 | 0.410 | 280800.0 | 0.151 | 0.152 | 0.150 | 0.150 | 36330.0 |
5 rows × 1260 columns
phisix_symbol = 'JFC'
yahoo_symbol = "GOOGL"
start_date = '2020-4-1'
end_date = '2020-4-14'
format = "oc"
#query within cache
df = get_stock_data(phisix_symbol,
start_date,
end_date,
source="phisix",
format=format
)
df.tail()
open | close | |
---|---|---|
dt | ||
2020-04-06 | 104.6 | 106.0 |
2020-04-07 | 110.2 | 110.5 |
2020-04-08 | 111.0 | 120.0 |
2020-04-13 | 121.0 | 135.0 |
2020-04-14 | 139.9 | 146.5 |
#query within cache
df = get_stock_data(phisix_symbol,
start_date,
end_date,
source="phisix",
#format=format
)
df.tail()
close | |
---|---|
dt | |
2020-04-06 | 106.0 |
2020-04-07 | 110.5 |
2020-04-08 | 120.0 |
2020-04-13 | 135.0 |
2020-04-14 | 146.5 |
#query within cache
df = get_stock_data(yahoo_symbol,
start_date,
end_date,
source="yahoo",
format=format
)
df.tail()
[*********************100%***********************] 1 of 1 completed
open | close | |
---|---|---|
dt | ||
2020-04-06 | 1133.000000 | 1183.189941 |
2020-04-07 | 1217.010010 | 1182.560059 |
2020-04-08 | 1203.099976 | 1207.000000 |
2020-04-09 | 1218.180054 | 1206.569946 |
2020-04-13 | 1201.500000 | 1210.410034 |
#extend cache
end_date = "2020-04-16"
df = get_stock_data(phisix_symbol,
start_date,
end_date,
source="phisix",
format=format
)
df.tail()
open | close | |
---|---|---|
dt | ||
2020-04-08 | 111.0 | 120.0 |
2020-04-13 | 121.0 | 135.0 |
2020-04-14 | 139.9 | 146.5 |
2020-04-15 | 150.0 | 148.6 |
2020-04-16 | 147.0 | 141.5 |
#extend cache
end_date = "2020-04-16"
df = get_stock_data(phisix_symbol,
start_date,
end_date,
source="phisix",
#format=format
)
df.tail()
close | |
---|---|
dt | |
2020-04-08 | 120.0 |
2020-04-13 | 135.0 |
2020-04-14 | 146.5 |
2020-04-15 | 148.6 |
2020-04-16 | 141.5 |
#extend cache
df = get_stock_data(yahoo_symbol,
start_date,
end_date,
source="yahoo",
format=format
)
df.tail()
[*********************100%***********************] 1 of 1 completed
open | close | |
---|---|---|
dt | ||
2020-04-08 | 1203.099976 | 1207.000000 |
2020-04-09 | 1218.180054 | 1206.569946 |
2020-04-13 | 1201.500000 | 1210.410034 |
2020-04-14 | 1239.969971 | 1265.229980 |
2020-04-15 | 1246.510010 | 1257.300049 |