Skip to content

OpenBB-finance/hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Quick Start Guide for the OpenBB Data API

This guide is intended to provide some starting points for querying data from the OpenBB API. Please refer to the API documentation page here for more detail.

Some of the uses for the available data are:

  • Training a model
  • Testing a hypothesis
  • Building trading strategies
  • Market and macroeconomic forecasting
  • Due diligence of individual companies
  • Interactive dashboards and reports

API Authorization

The API requires encoding the username and password as a Base64 string, added to the headers in every request. Adjust the Python syntax below for your specific system.

User: openbb Password: password_you_received_from_the_organizer

import base64
import requests

msg = "openbb:password_you_received_from_the_organizer"
msg_bytes = msg.encode("ascii")
base64_bytes = base64.b64encode(msg_bytes)
base64_msg = base64_bytes.decode("ascii")

symbol="SPY"
url = f"http://hackathon.openbb.dev/api/v1/equity/price/quote?provider=intrinio&symbol={symbol}&source=intrinio_mx"
headers = {"accept": "application/json", "Authorization": f"Basic {base64_msg}"}

response = requests.get(url=url, headers=headers)

response.json()

Example Curl Request

! curl -X 'GET' \
  'https://hackathon.openbb.dev/api/v1/economy/cpi?provider=fred&countries=australia&countries=china&units=growth_same&frequency=annual&harmonized=false' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic b3BlbmJiOm1pbmRzZGIyMDI0'

Swagger Docs and Parameters

  • The API has Swagger documentation that is available at this url: http://hackathon.openbb.dev/docs

  • The docs page shows all available endpoints and their parameters.

  • The openapi.json file is located here

  • Requests made with invalid parameter names will be ignored.

  • Data sources (provider) are entered as a choice of: ["benzinga", "intrinio", "fmp", "fred", "sec"] to the provider parameter of any endpoint.

  • Parameters with only one choice do not need to be defined.

  • Supply lists of symbols as a string - symbols = "AAPL,MSFT,NFLX,GOOG,AMZN" - but not every function is equipped for multi-ticker requests.

  • Date parameters should be defined as: "YYYY-MM-DD"

  • Functions with a limit or page_size parameter may have a default state that does not return all results. Set this parameter as an integer.

Example Endpoints

Releases

No releases published

Packages

No packages published