Skip to content
All library documents

Finding Faster Intraday Stock Data for Pandas

Article Quant Q&A · Author: Cole

Summary

The document describes a workflow for obtaining stock price data, turning timestamped records into a Pandas DataFrame, and saving the results. The intended application is to compare American depositary receipts with their ordinary-share counterparts, alongside the relevant currency, using observations faster than five-minute intervals. The example uses a third-party market-data endpoint and shows basic extraction, JSON handling, timestamp conversion, sorting, and selection of date and closing-price columns.

The question is whether a school Bloomberg Terminal license can provide finer intervals or whether another source is needed. The accepted response recommends asking about a student offer from a commercial data provider, which may raise request limits for eligible students. It does not explain the terminal’s intraday capabilities, establish tick-level availability, demonstrate an API integration, or compare costs and data quality across vendors. The recommendation is narrow and does not guarantee that the suggested service meets a specific sampling frequency, coverage, or usage requirement. Users should check those constraints before relying on a source for research.

Key ideas

  • A basic Python workflow can convert timestamped market records into a sorted Pandas DataFrame.
  • The stated use case requires faster observations for comparing depositary receipts, ordinary shares, and currency.
  • A student account or offer may provide higher data request limits.
  • The document does not establish whether the school terminal or suggested provider supplies the required high-frequency observations.

Tags

Full text
# Second by second stock data from Bloomberg API (or anywhere else that is free) into Pandas Dataframe


# Second by second stock data from Bloomberg API (or anywhere else that is free) into Pandas Dataframe












I need to compile stock price data for ADR and ORD pairs (and the currency between them) into a Pandas dataframe. My initial plan was use Python's requests library and a free Rapid API account to get data from the Bloomberg API, the code for which I've attached below. The issue with this is that the time intervals seem to be 5 minutes at the fastest, and I need much faster. (The "MY RAPID API KEY" is removed because you must create a free account to get a key. I'm already near the limit of requests my account can make for the month so I can't give it out, sorry for the inconvenience)

```
import requests
import pandas as pd
import numpy as np
import datetime

def extract_ticks(interval="d1"):
    url="https://bloomberg-market-and-financial-news.p.rapidapi.com/market/get-chart"
    querystring = {"interval":interval,"id":"dge:ln"}
    headers = {
        'x-rapidapi-host': "bloomberg-market-and-financial-news.p.rapidapi.com",
        'x-rapidapi-key': "MY RAPID API KEY"
        }
    response = requests.request("GET", url, headers=headers, params=querystring)
    json_d = response.json()
    return json_d
#Get year to date data ytd
json_d = extract_ticks()
print(json_d) 

# Write the data to json file
import json
with open("dge_ytd.json","w") as fp:
    json.dump(json_d,fp)

import pandas as pd
import datetime
with open("dge_ytd.json","r") as fp:
     json_d = json.load(fp)
 ticks_d = json_d['result']['DGE:LN']['ticks']
 df = pd.DataFrame(ticks_d)
 df['Close'] = df['close']
 df['Date'] = df['time'].apply(lambda x:datetime.datetime.fromtimestamp(x))
 df = df.set_index('time')
 data = df.sort_index(ascending=True, axis=0)
 data

#creating a separate dataset
 new_data = data[['Date','Close']]
 index = range(0,len(new_data))
 new_data['index']=index
 new_data=new_data.set_index('index')
 new_data['Date'] = pd.to_datetime(new_data.Date,format='%Y-%m-%d')
 new_data
```

This code does great work for the formatting I need and storage of the Dataframe, and the Bloomberg API is very easy to use. My school has a Bloomberg Terminal, which I've never used before. Can I get faster time intervals using the Terminal license, or will I need to find a different data source? If so, what data sources can I use that I can get for very cheap and how can I get the data into a pandas df?

Thanks in advance, and let me know if there's any clarifying information I can provide in the comments; this is my first question so I'm hoping I followed the correct formatting procedure (I couldn't copy in Jupyter output without columns getting mangled together)

## Answer by Nikolai Kl (score 0, accepted)

https://quant.stackexchange.com/a/61381

Hi you can use Alphavantage and inquire a student offer, that gives you more calls per minute and more calls per month. You only have to have a student mail account and confirm the purposes of your endeavour.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.