Skip to main content

API client for BDO market

Project description

Contributors Forks Stargazers Issues project_license discord


Logo

bdomarket

API client for BDO market data

PyPI · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This code is a simple and well-structured API client for BDO market data, built for convenience. It enables developers to access market information, price history, and shop data from Arsha.io in a standardized way.

Features

  • Market Data Access: Retrieve real-time and historical data from the BDO Central Market, including waitlists, hotlists, item lists, sublists, search results, bidding info, and price info.
  • Boss Timers: Easily fetch and display world boss spawn times for different servers and regions.
  • Item Management: Query single or multiple items by ID, dump large ranges of item data, and work with item objects that support conversion to dictionaries and icon downloading.
  • API Response Handling: All API calls return a standardized ApiResponse object, making it easy to access content, status codes, and success flags, as well as to deserialize responses into Python objects.
  • Data Export: Save any API response directly to a file in JSON format for later analysis or debugging.
  • Timestamp Conversion: Convert Unix timestamps from API responses into human-readable date and time strings.
  • Multi-Region and Multi-Language Support: Easily switch between different BDO regions (EU, NA, etc.) and supported languages.
  • Convenient Utilities: Download item icons, print readable representations of items, and more.
  • Regional Pig Cave Status: Easily fetch pig cave status for different regions.

(back to top)

Get involved

discord

Donate

If you like my project, you can buy me a coffee, many thanks ❤️ !

Built With

Python

(back to top)

Getting Started

A Python API client for accessing the Arsha.io Black Desert Online Market API.

Easily retrieve market data, hotlist items, price history, bidding info, and more.

Prerequisites

Python installed on your system.

  • Python >= 3.9

Installation

pip install bdomarket

(back to top)

Usage

import asyncio
import bdomarket

async def async_example():
    # Get Pig Cave status (async)
    pigregion = bdomarket.PigCave.EU
    pigcave = bdomarket.Pig(pigregion)
    pigstatus = await pigcave.get_status()
    print(f"Pig Cave status ({pigregion.value}): {pigstatus}")
    pigstatus.save_to_file("responses/async/pigcave/status.json")
    
    # Initialize Market with EU region, V2 API, English locale
    async with bdomarket.Market(region=bdomarket.MarketRegion.EU, api_version=bdomarket.ApiVersion.V2, language=bdomarket.Locale.English) as market:
        # Get world market wait list (async)
        wait_list = await market.get_world_market_wait_list()
        print("World Market Wait List:", wait_list.success, wait_list.status_code)
        wait_list.save_to_file("responses/async/waitlist/get.json")

        # Post world market wait list (async)
        post_wait_list = await market.post_world_market_wait_list()
        print("Post World Market Wait List:", post_wait_list.success, post_wait_list.status_code)
        post_wait_list.save_to_file("responses/async/waitlist/post.json")

        # Get world market hot list (async)
        hot_list = await market.get_world_market_hot_list()
        print("World Market Hot List:", hot_list.success, hot_list.status_code)
        hot_list.save_to_file("responses/async/hotlist/get.json")

        # Post world market hot list (async)
        post_hot_list = await market.post_world_market_hot_list()
        print("Post World Market Hot List:", post_hot_list.success, post_hot_list.status_code)
        post_hot_list.save_to_file("responses/async/hotlist/post.json")

        # Get market price info for items (async)
        price_info = await market.get_market_price_info(ids=["735008", "735009"], sids=["20", "20"], convertdate=True, formatprice=False)
        print("Market Price Info:", price_info.success, price_info.status_code)
        price_info.save_to_file("responses/async/priceinfo/get.json")

        # Post market price info (async)
        post_price_info = await market.post_market_price_info(ids=["735008", "735009"], sids=["20", "20"], convertdate=True, formatprice=False)
        print("Post Market Price Info:", post_price_info.success, post_price_info.status_code)
        post_price_info.save_to_file("responses/async/priceinfo/post.json")

        # Get world market search list (async)
        search_list = await market.get_world_market_search_list(ids=["735008"])
        print("World Market Search List:", search_list.success, search_list.status_code)
        search_list.save_to_file("responses/async/searchlist/get.json")

        # Post world market search list (async)
        post_search_list = await market.post_world_market_search_list(ids=["735008"])
        print("Post World Market Search List:", post_search_list.success, post_search_list.status_code)
        post_search_list.save_to_file("responses/async/searchlist/post.json")

        # Get world market list by category (async)
        market_list = await market.get_world_market_list(main_category="1", sub_category="1")
        print("World Market List:", market_list.success, market_list.status_code)
        market_list.save_to_file("responses/async/marketlist/get.json")

        # Post world market list (async)
        post_market_list = await market.post_world_market_list(main_category="1", sub_category="1")
        print("Post World Market List:", post_market_list.success, post_market_list.status_code)
        post_market_list.save_to_file("responses/async/marketlist/post.json")

        # Get world market sub list (async)
        sub_list = await market.get_world_market_sub_list(ids=["735008"])
        print("World Market Sub List:", sub_list.success, sub_list.status_code)
        sub_list.save_to_file("responses/async/sublist/get.json")

        # Post world market sub list (async)
        post_sub_list = await market.post_world_market_sub_list(ids=["735008"])
        print("Post World Market Sub List:", post_sub_list.success, post_sub_list.status_code)
        post_sub_list.save_to_file("responses/async/sublist/post.json")

        # Get bidding info (async)
        bidding_info = await market.get_bidding_info(ids=["735008", "735009"], sids=["20", "20"])
        print("Bidding Info:", bidding_info.success, bidding_info.status_code)
        bidding_info.save_to_file("responses/async/biddinginfo/get.json")

        # Post bidding info (async)
        post_bidding_info = await market.post_bidding_info(ids=["735008", "735009"], sids=["20", "20"])
        print("Post Bidding Info:", post_bidding_info.success, post_bidding_info.status_code)
        post_bidding_info.save_to_file("responses/async/biddinginfo/post.json")

        # Get pearl items (async)
        pearl_items = await market.get_pearl_items()
        print("Pearl Items:", pearl_items.success, pearl_items.status_code)
        pearl_items.save_to_file("responses/async/pearlitems/get.json")

        # Post pearl items (async)
        post_pearl_items = await market.post_pearl_items()
        print("Post Pearl Items:", post_pearl_items.success, post_pearl_items.status_code)
        post_pearl_items.save_to_file("responses/async/pearlitems/post.json")

        # Get market (async)
        market_data = await market.get_market()
        print("Market Data:", market_data.success, market_data.status_code)
        market_data.save_to_file("responses/async/marketdata/get.json")

        # Post market (async)
        post_market_data = await market.post_market()
        print("Post Market Data:", post_market_data.success, post_market_data.status_code)
        post_market_data.save_to_file("responses/async/marketdata/post.json")

        # Get item by ID (async)
        item = await market.get_item(ids=["735008"])
        print("Item Info:", item.success, item.status_code)
        item.save_to_file("responses/async/item/get.json")

        # Get item database dump (async)
        item_dump = await market.item_database_dump(start_id=1, end_id=10, chunk_size=5)
        print("Item Database Dump:", item_dump.success, item_dump.status_code)
        item_dump.save_to_file("responses/async/itemdump/get.json")

def sync_example():
    # Get boss timer
    bosstimer = bdomarket.Boss().Scrape()
    print("Boss Timer:", bosstimer.GetTimer())
    print("Boss Timer JSON:", bosstimer.GetTimerJSON())

    # Get item icon
    item = bdomarket.Item(id="735008")
    item.GetIcon("responses/sync/icons", True, bdomarket.ItemProp.NAME)
    item.GetIcon("responses/sync/icons", True, bdomarket.ItemProp.ID)
    print("Item Icons saved to responses/icons")
    
    market = bdomarket.Market(region=bdomarket.MarketRegion.EU, api_version=bdomarket.ApiVersion.V2, language=bdomarket.Locale.English)
    # Get world market wait list (sync)
    wait_list = market.get_world_market_wait_list_sync()
    print("World Market Wait List:", wait_list.success, wait_list.status_code)
    wait_list.save_to_file("responses/sync/waitlist/get.json")

    # Post world market wait list (sync)
    post_wait_list = market.post_world_market_wait_list_sync()
    print("Post World Market Wait List:", post_wait_list.success, post_wait_list.status_code)
    post_wait_list.save_to_file("responses/sync/waitlist/post.json")

    # Get world market hot list (sync)
    hot_list = market.get_world_market_hot_list_sync()
    print("World Market Hot List:", hot_list.success, hot_list.status_code)
    hot_list.save_to_file("responses/sync/hotlist/get.json")

    # Post world market hot list (sync)
    post_hot_list = market.post_world_market_hot_list_sync()
    print("Post World Market Hot List:", post_hot_list.success, post_hot_list.status_code)
    post_hot_list.save_to_file("responses/sync/hotlist/post.json")

    # Get market price info for items (sync)
    price_info = market.get_market_price_info_sync(ids=["735008", "735009"], sids=["20", "20"], convertdate=True, formatprice=False)
    print("Market Price Info:", price_info.success, price_info.status_code)
    price_info.save_to_file("responses/sync/priceinfo/get.json")

    # Post market price info (sync)
    post_price_info = market.post_market_price_info_sync(ids=["735008", "735009"], sids=["20", "20"], convertdate=True, formatprice=False)
    print("Post Market Price Info:", post_price_info.success, post_price_info.status_code)
    post_price_info.save_to_file("responses/sync/priceinfo/post.json")

    # Get world market search list (sync)
    search_list = market.get_world_market_search_list_sync(ids=["735008"])
    print("World Market Search List:", search_list.success, search_list.status_code)
    search_list.save_to_file("responses/sync/searchlist/get.json")

    # Post world market search list (sync)
    post_search_list = market.post_world_market_search_list_sync(ids=["735008"])
    print("Post World Market Search List:", post_search_list.success, post_search_list.status_code)
    post_search_list.save_to_file("responses/sync/searchlist/post.json")

    # Get world market list by category (sync)
    market_list = market.get_world_market_list_sync(main_category="1", sub_category="1")
    print("World Market List:", market_list.success, market_list.status_code)
    market_list.save_to_file("responses/sync/marketlist/get.json")

    # Post world market list (sync)
    post_market_list = market.post_world_market_list_sync(main_category="1", sub_category="1")
    print("Post World Market List:", post_market_list.success, post_market_list.status_code)
    post_market_list.save_to_file("responses/sync/marketlist/post.json")

    # Get world market sub list (sync)
    sub_list = market.get_world_market_sub_list_sync(ids=["735008"])
    print("World Market Sub List:", sub_list.success, sub_list.status_code)
    sub_list.save_to_file("responses/sync/sublist/get.json")

    # Post world market sub list (sync)
    post_sub_list = market.post_world_market_sub_list_sync(ids=["735008"])
    print("Post World Market Sub List:", post_sub_list.success, post_sub_list.status_code)
    post_sub_list.save_to_file("responses/sync/sublist/post.json")

    # Get bidding info (sync)
    bidding_info = market.get_bidding_info_sync(ids=["735008", "735009"], sids=["20", "20"])
    print("Bidding Info:", bidding_info.success, bidding_info.status_code)
    bidding_info.save_to_file("responses/sync/biddinginfo/get.json")

    # Post bidding info (sync)
    post_bidding_info = market.post_bidding_info_sync(ids=["735008", "735009"], sids=["20", "20"])
    print("Post Bidding Info:", post_bidding_info.success, post_bidding_info.status_code)
    post_bidding_info.save_to_file("responses/sync/biddinginfo/post.json")

    # Get pearl items (sync)
    pearl_items = market.get_pearl_items_sync()
    print("Pearl Items:", pearl_items.success, pearl_items.status_code)
    pearl_items.save_to_file("responses/sync/pearlitems/get.json")

    # Post pearl items (sync)
    post_pearl_items = market.post_pearl_items_sync()
    print("Post Pearl Items:", post_pearl_items.success, post_pearl_items.status_code)
    post_pearl_items.save_to_file("responses/sync/pearlitems/post.json")

    # Get market (sync)
    market_data = market.get_market_sync()
    print("Market Data:", market_data.success, market_data.status_code)
    market_data.save_to_file("responses/sync/marketdata/get.json")

    # Post market (sync)
    post_market_data = market.post_market_sync()
    print("Post Market Data:", post_market_data.success, post_market_data.status_code)
    post_market_data.save_to_file("responses/sync/marketdata/post.json")

    # Get item by ID (sync)
    item = market.get_item_sync(ids=["735008"])
    print("Item Info:", item.success, item.status_code)
    item.save_to_file("responses/sync/item/get.json")

    market.close()

if __name__ == "__main__":
    print("Loading...")
    asyncio.run(async_example())
    sync_example()
    print("Done!")

(back to top)

Roadmap

  • Market Data Access
    • Retrieve real-time market data
    • Retrieve historical market data
    • Get waitlists, hotlists, item lists, sublists, and search results
  • Boss Timers
    • Fetch world boss spawn times for all supported servers and regions
  • Item Management
    • Query single or multiple items by ID
    • Dump large ranges of item data
    • Item object conversion to dictionary
    • Download item icons
    • Searching items by name or ID in DBdump?
  • API Response Handling
    • Standardized ApiResponse object for all API calls
    • Deserialize responses into Python objects
  • Data Export
    • Save API responses to JSON files
  • Timestamp Conversion
    • Convert Unix timestamps to human-readable format
  • Multi-Region and Multi-Language Support
    • Switch between BDO regions
    • Switch between supported languages
  • Utilities
    • Print readable representations of items
    • Additional helper functions
  • Error Handling & Robustness
    • Graceful handling of network/API errors
    • Retry logic for failed requests
    • Logging for debugging and monitoring
  • Documentation
    • Comprehensive API documentation
    • Usage examples and tutorials
    • Docstrings for all public classes and methods
  • Testing
    • Unit tests for core functionality
    • Integration tests for API endpoints
  • Search & Filtering
    • Search items by name or partial match
    • Filter market data by category, price, etc.
  • Performance Improvements
    • Async support for faster data retrieval
  • CLI Tool
    • Command-line interface for quick queries and downloads
  • Webhook/Notification Support
    • Notify users of market changes or boss

See the open issues for a full list of proposed features (and known issues).

(back to top)

Example:

market.GetBiddingInfo(["735008", "731109"], ["19", "20"]).SaveToFile("responses/bidding/get.json")

Outputs:

{
  "success": true,
  "statuscode": 200,
  "message": "No message provided",
  "content": [
    {
      "name": "Blackstar Shuriken",
      "id": 735008,
      "sid": 19,
      "orders": [
        {
          "price": 14500000000,
          "sellers": 1,
          "buyers": 0
        },
        {
          "price": 15500000000,
          "sellers": 1,
          "buyers": 0
        },
        {
          "price": 14900000000,
          "sellers": 4,
          "buyers": 0
        },
        {
          "price": 14700000000,
          "sellers": 0,
          "buyers": 0
        }
      ]
    },
    {
      "name": "Blackstar Sura Katana",
      "id": 731109,
      "sid": 20,
      "orders": [
        {
          "price": 72500000000,
          "sellers": 1,
          "buyers": 0
        },
        {
          "price": 73500000000,
          "sellers": 1,
          "buyers": 0
        },
        {
          "price": 73000000000,
          "sellers": 1,
          "buyers": 0
        },
        {
          "price": 70500000000,
          "sellers": 0,
          "buyers": 0
        }
      ]
    }
  ]
}

Top contributors:

contrib.rocks image

License

Distributed under the GNU General Public License v3.0.
See LICENSE for more information.

This project is copyleft: you may copy, distribute, and modify it under the terms of the GPL, but derivative works must also be open source under the same license.

Learn more about GPL-3.0 »

(back to top)

Contact

Project Link: https://github.com/Fizzor96/bdomarket

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bdomarket-0.2.7.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdomarket-0.2.7-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file bdomarket-0.2.7.tar.gz.

File metadata

  • Download URL: bdomarket-0.2.7.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bdomarket-0.2.7.tar.gz
Algorithm Hash digest
SHA256 068cf32123e13208a728cf670742fbc32fe29111f61bf9829225f21987c64d98
MD5 3482665420420b83c85166ce1b496257
BLAKE2b-256 53f11263376ac91c9b73f2d50ba48489eae140636723d8954d336e0ddadcfd00

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdomarket-0.2.7.tar.gz:

Publisher: release.yml on Fizzor96/bdomarket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bdomarket-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: bdomarket-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bdomarket-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f72c18d1665ff479e4dc203506256b86266e6e2b1e5deeb9b3d7998cf668e46a
MD5 1ef89fd4b4ff697c1609a147413fd315
BLAKE2b-256 a1bb5b8fb89e509dc42fe907c39e4b113ea26e2750deb639730ad2ea0c1e4d7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdomarket-0.2.7-py3-none-any.whl:

Publisher: release.yml on Fizzor96/bdomarket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page