Looking up Specific Company Minute Data
OlafGeorge opened this issue · 1 comments
OlafGeorge commented
Hey sorry for commenting on the previous issue, I am new to GitHub.
I am wondering if you can add a code that can get the minute data of Nasdaq or any stock under the USA (BATS) section of finam.
I have tried to write a code to access it, but you seem to be a professional at coding and I could really use your help.
Thanks,
Olaf
ffeast commented
Hello
You can find the script below. Caveats:
- there're gaps in minutes data for nasdaq. I don't know why it's happening, finam's data has the same issue when downloaded directly from their website
- you can't download minutes data for a long timespan due to finam.ru's restrictions, so you need to break up the desired interval into smaller chunks. Maybe I'll automate it one day
#!/usr/bin/env python
import logging
import datetime
from finam.export import Exporter, Market, LookupComparator, Timeframe
"""
Full-on example displaying up-to-date values of some important indicators
"""
def main():
exporter = Exporter()
nasdaq = exporter.lookup(code='NDAQ', market=Market.USA)
data = exporter.download(nasdaq.index[0],
market=Market.USA,
timeframe=Timeframe.MINUTES1,
start_date=datetime.date(2020, 1, 31),
end_date=datetime.date(2020, 2, 1))
print(data.head(10))
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
main()