Skip to main content

API client for BDO market

Project description

PyPI - Downloads 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.content}")
    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")

        # EXPERIMENTAL! Get item database dump (async) - avoid using this
        item_dump = await market.item_database_dump(start_id=1, end_id=10, chunk_size=5, showstatus=False)
        print("Item Database Dump:", item_dump.success, item_dump.status_code)
        item_dump.save_to_file("responses/async/itemdump/partial.json")
        
        # Get item database dump full (async)
        item_dump_full = await market.item_database_dump_v2()
        item_dump_full.save_to_file("responses/async/itemdump/get.json")
        print("Item Database Dump Full:", item_dump_full.success, item_dump_full.status_code)
        print(len(item_dump_full.content))
        print(bdomarket.get_items_by_name_from_db(item_dump_full.content, "Blackstar Shuriken"))
        print(bdomarket.get_items_by_id_from_db(item_dump_full.content, 735008))

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
  • 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.14.tar.gz (44.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.14-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bdomarket-0.2.14.tar.gz
  • Upload date:
  • Size: 44.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.14.tar.gz
Algorithm Hash digest
SHA256 209722fad3ee8244a78640771342ee5b84a17a9eadbfeb43839a87a21fda2cea
MD5 677c3e839aa8d03d84ce9ac1b470c1c0
BLAKE2b-256 793bdd744956399e78effa9ca651d3f297c640742544ec356de233ac8e8d9766

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdomarket-0.2.14.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.14-py3-none-any.whl.

File metadata

  • Download URL: bdomarket-0.2.14-py3-none-any.whl
  • Upload date:
  • Size: 40.8 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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 bfae521efe9b851eff06638a0806042e677405ef8b6ab2023d33ea45e4895f51
MD5 781ee6c90270e166a77a7f9cd44c813b
BLAKE2b-256 2fa3b416053a10b871bcb5e073fbda1f4f561bcf8522628cf674e0ae9e7ce982

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdomarket-0.2.14-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