Giter Club home page Giter Club logo

sumitdnath / cme-data-scraper Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 132 KB

The CME Group Futures Data Scraper is a Python script that enables users to retrieve futures data from the CME Group API and transform it into a structured format for analysis. The script offers a convenient way to access and process financial data from the Chicago Mercantile Exchange (CME) for a specified date.

License: MIT License

Jupyter Notebook 100.00%

cme-data-scraper's Introduction

CME-Data-Scraper

The CME Group Futures Data Scraper is a Python script that enables users to retrieve futures data from the CME Group API and transform it into a structured format for analysis. The script offers a convenient way to access and process financial data from the Chicago Mercantile Exchange (CME) for a specified date.

Prerequisites

Before running the script, make sure you have the following dependencies installed:

  • Python (3.x)
  • requests library
  • pandas library

You can install the required Python packages using pip:

pip install requests pandas

Explanation

  1. Import necessary libraries:
import requests
import pandas as pd

  1. Set the date variable to the desired date for fetching futures data from CME Group.
  2. Construct the URL for the CME Group API endpoint, including the date parameter.
  3. Define the headers required for making the HTTP request. Be sure to include any necessary cookies or authentication tokens in the 'Cookie' field (as it is omitted for brevity).
  4. Use the requests.get() method to download futures data from the CME Group API.
  5. Convert the JSON response from the API into a Pandas DataFrame, making it easier to work with and analyze.
  6. Extract the 'settlements' data from the DataFrame using pd.json_normalize().
  7. Concatenate the 'settlements' DataFrame with the original futures data DataFrame, creating a combined DataFrame.
  8. Select and display the desired columns from the combined DataFrame, including 'month,' 'open,' 'high,' 'low,' 'last,' 'change,' 'settle,' 'volume,' 'openInterest,' 'tradeDate,' 'dsHeader,' and 'reportType'.

Output

alt text

Capture and display screenshots of the script in action.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.