Giter Site home page Giter Site logo

cs2-price-api's Introduction

CS2 Market API

Implementation for a future CS2 Market Bot

This is a Flask web app that provides two API endpoints to get item data for weapons, cases, and items in CS2. The item data is fetched by calling functions from another module called marketdata, which retrieves the highest buy order and lowest sell order price for an item, as well as its nameid.

Installation

To run the Flask app, you need to install Python 3 and the required Python packages listed in the requirements.txt file. You can install the packages using the following command:

pip install -r requirements.txt

Usage

To start the Flask app, run the following command:

python main.py

This will start the app in debug mode. The API endpoints are:

POST /api/weapon: retrieves item data for a weapon based on its name, skin, wear, and stat.
POST /api/case: retrieves item data for a case based on its name.

Both endpoints require a JSON object in the request body with the appropriate keys and values. If the item data is not available, the response will contain an error message.

API Documentation

/api/weapon

Returns data about a weapon skin in the game.

Method

POST

Request Body

Parameter Type Description Example
gun string The name of the weapon. "AK-47"
skin string The name of the skin for the weapon. "Asiimov"
wear integer The wear of the skin, represented by a number between 1 (Factory New) and 5 (Battle-Scarred). 3
stat integer Whether the skin has StatTrak™ or not. 1 represents that the skin has StatTrak™, and 0 represents that it does not. 1

Example Request

POST /api/weapon HTTP/1.1
Content-Type: application/json

{
 "gun": "AK-47",
 "skin": "Redline",
 "wear": 3,
 "stat": 1
}

Would return data for a StatTrak AK-47 | Redline (Field-Tested), such as

{
    "buy_req": 54.25,
    "nameid": "7180207",
    "sell_req": 60.79,
    "volume": 29
}

/api/case

Returns data about a case or item. The item functionality is limited and not reccommended to use.

Method

POST

Request Body

Parameter Type Description Example
case string The name of the case. "Snakebite Case"

Example Request

POST /api/case HTTP/1.1
Content-Type: application/json

{
 "case": "Snakebite Case"
}

Would return data for the Snakebite Case, such as

{
    "buy_req": 0.37,
    "nameid": "176240926",
    "sell_req": 0.38
}

Note: volume data not avaliable for cases.

TO-DO

  • Add proxy support (steam market ratelimit)
    • volume function might affect ratelimits?
  • Add other buy/sell orders
  • Make /api/case have better item functionality.

cs2-price-api's People

Contributors

ethnyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.