# binance/binance-spot-api-docs architecture

> Architecture diagram of the GitHub repository binance/binance-spot-api-docs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/binance/binance-spot-api-docs
- Repository: https://github.com/binance/binance-spot-api-docs

## Overview

##### Main Components
- Documentation Entry Points – Represent the primary API domains:
- REST API for Spot Trading (documented in rest-api.md, related endpoints, and error codes in errors.md).
- WebSocket API components:
- Spot Market Data WebSocket streams (web-socket-streams.md).
- Spot User Data WebSocket streams (user-data-stream.md).
- FIX API Documentation (fix-api.md and relevant FIX schemas under /fix).
- SBE Schemas – Under the “sbe” directory (spot and stream schemas in XML/JSON format).
- Testnet Documentation – A separate folder with testnet-specific documents.
- FAQ and Auxiliary Materials – FAQs (commissions, SBE FAQ, trailing-stop, etc.), Enums, Error codes, Filters.

##### Relationships and Interactions
- How each component relates to the central notion of “Binance API Documentation.” For example:
- The REST API, WebSocket API, FIX API, and SBE components are all part of the documentation and provide specific technical details and specifications.
- The Testnet documentation can be seen as a parallel branch of the spot API documentation with separate files (indicating a clear separation between production and test environments).

##### Architectural Patterns and Design Principles
- Abstraction Layers: The documentation is modularized by topics (e.g., market data, user data, encoding schemas).
- Reusability: Common resources (such as enums, errors, filters) are used throughout multiple sections, indicating an emphasis on reducing duplication.
- Environment Separation: A clear split between production (“Binance API Documentation”) and Testnet elements.

##### Relevant Technologies, Formats, and Domain-Specific Elements
- The use of XML and JSON for schema definitions (e.g., in the SBE folder) is also important to indicate the technical representation of data for the API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Central["Binance API Documentation"]:::main

    %% Main Branches
    REST["REST API (Spot Trading)"]:::api
    WS["WebSocket API"]:::ws
    FIX["FIX API"]:::fix
    SBE["SBE Schemas"]:::sbe
    TESTNET["Testnet Documentation"]:::testnet
    FAQ["FAQs & Aux Materials"]:::faq

    %% Central connections
    Central --> REST
    Central --> WS
    Central --> FIX
    Central --> SBE
    Central --> TESTNET
    Central --> FAQ

    %% REST API Branch
    REST --> RESTdoc1["rest-api.md"]:::api
    REST --> RESTdocCN["rest-api_CN.md"]:::api
    REST --> ERR["errors.md"]:::faq
    REST --> ERRCN["errors_CN.md"]:::faq
    RESTdoc1 --> ERR
    RESTdocCN --> ERRCN

    %% WebSocket API Branch
    WS --> WMDS["web-socket-streams.md"]:::ws
    WS --> WMDS_CN["web-socket-streams_CN.md"]:::ws
    WS --> WDUS["user-data-stream.md"]:::ws
    WS --> WDUS_CN["user-data-stream_CN.md"]:::ws
    WS --> WSA["web-socket-api.md"]:::ws
    WS --> WSA_CN["web-socket-api_CN.md"]:::ws

    %% FIX API Branch
    FIX --> FIXdoc["fix-api.md"]:::fix
    FIX --> FIXdoc_CN["fix-api_CN.md"]:::fix
    FIX --> FIXSCHEMAS["fix/schemas"]:::fix
    FIXSCHEMAS --> FIX_SCHEMA1["spot-fix-md.xml"]:::fix
    FIXSCHEMAS --> FIX_SCHEMA2["spot-fix-oe.xml"]:::fix

    %% SBE Schemas Branch
    SBE --> SBEdoc["sbe-market-data-streams.md"]:::sbe
    SBE --> SBEdoc_CN["sbe-market-data-streams_CN.md"]:::sbe
    SBE --> SBE_SchemasFolder["sbe/schemas"]:::sbe

    %% Testnet Documentation Branch
    TESTNET --> TestnetFolder["testnet"]:::testnet
    TestnetFolder --> TREST["rest-api.md"]:::testnet
    TestnetFolder --> TFIX["fix-api.md"]:::testnet
    TestnetFolder --> TSBE["sbe-market-data-streams.md"]:::testnet
    TestnetFolder --> TUSER["user-data-stream.md"]:::testnet
    TestnetFolder --> TWSAPI["web-socket-api.md"]:::testnet
    TestnetFolder --> TWSSTREAM["web-socket-streams.md"]:::testnet
    TestnetFolder --> CHANGELOG["CHANGELOG.md"]:::testnet
    TestnetFolder --> TESTNET_TERMS["TESTNET-TERMS-OF-USE.md"]:::testnet
    TestnetFolder --> TENUM["enums.md"]:::faq
    TestnetFolder --> TERROR["errors.md"]:::faq

    %% FAQs & Aux Materials Branch
    FAQ --> FAQsFolder["faqs"]:::faq
    FAQsFolder --> FAQ1["api_key_types.md"]:::faq
    FAQsFolder --> FAQ2["commission_faq.md"]:::faq
    FAQsFolder --> FAQ3["market_data_only.md"]:::faq
    FAQsFolder --> FAQ4["market_orders_faq.md"]:::faq
    FAQsFolder --> FAQ5["order_amend_keep_priority.md"]:::faq
    FAQsFolder --> FAQ6["order_count_decrement.md"]:::faq
    FAQsFolder --> FAQ7["sbe_faq.md"]:::faq
    FAQsFolder --> FAQ8["sor_faq.md"]:::faq
    FAQsFolder --> FAQ9["spot_glossary.md"]:::faq
    FAQsFolder --> FAQ10["stp_faq.md"]:::faq
    FAQsFolder --> FAQ11["trailing-stop-faq.md"]:::faq
    FAQ --> ENUMS["enums.md"]:::faq
    FAQ --> ENUMS_CN["enums_CN.md"]:::faq
    FAQ --> FILTERS["filters.md"]:::faq
    FAQ --> FILTERS_CN["filters_CN.md"]:::faq

    %% Click Events
    click RESTdoc1 "https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md"
    click RESTdocCN "https://github.com/binance/binance-spot-api-docs/blob/master/rest-api_CN.md"
    click ERR "https://github.com/binance/binance-spot-api-docs/blob/master/errors.md"
    click ERRCN "https://github.com/binance/binance-spot-api-docs/blob/master/errors_CN.md"
    
    click WMDS "https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md"
    click WMDS_CN "https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams_CN.md"
    click WDUS "https://github.com/binance/binance-spot-api-docs/blob/master/user-data-stream.md"
    click WDUS_CN "https://github.com/binance/binance-spot-api-docs/blob/master/user-data-stream_CN.md"
    click WSA "https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md"
    click WSA_CN "https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api_CN.md"
    
    click FIXdoc "https://github.com/binance/binance-spot-api-docs/blob/master/fix-api.md"
    click FIXdoc_CN "https://github.com/binance/binance-spot-api-docs/blob/master/fix-api_CN.md"
    click FIXSCHEMAS "https://github.com/binance/binance-spot-api-docs/tree/master/fix/schemas"
    click FIX_SCHEMA1 "https://github.com/binance/binance-spot-api-docs/blob/master/fix/schemas/spot-fix-md.xml"
    click FIX_SCHEMA2 "https://github.com/binance/binance-spot-api-docs/blob/master/fix/schemas/spot-fix-oe.xml"
    
    click SBEdoc "https://github.com/binance/binance-spot-api-docs/blob/master/sbe-market-data-streams.md"
    click SBEdoc_CN "https://github.com/binance/binance-spot-api-docs/blob/master/sbe-market-data-streams_CN.md"
    click SBE_SchemasFolder "https://github.com/binance/binance-spot-api-docs/tree/master/sbe/schemas"
    
    click TestnetFolder "https://github.com/binance/binance-spot-api-docs/tree/master/testnet"
    click TREST "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/rest-api.md"
    click TFIX "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/fix-api.md"
    click TSBE "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/sbe-market-data-streams.md"
    click TUSER "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/user-data-stream.md"
    click TWSAPI "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/web-socket-api.md"
    click TWSSTREAM "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/web-socket-streams.md"
    click CHANGELOG "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/CHANGELOG.md"
    click TESTNET_TERMS "https://github.com/binance/binance-spot-api-docs/blob/master/testnet/TESTNET-TERMS-OF-USE.md"
    
    click FAQsFolder "https://github.com/binance/binance-spot-api-docs/tree/master/faqs"
    click FAQ1 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/api_key_types.md"
    click FAQ2 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/commission_faq.md"
    click FAQ3 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/market_data_only.md"
    click FAQ4 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/market_orders_faq.md"
    click FAQ5 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/order_amend_keep_priority.md"
    click FAQ6 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/order_count_decrement.md"
    click FAQ7 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/sbe_faq.md"
    click FAQ8 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/sor_faq.md"
    click FAQ9 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/spot_glossary.md"
    click FAQ10 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/stp_faq.md"
    click FAQ11 "https://github.com/binance/binance-spot-api-docs/blob/master/faqs/trailing-stop-faq.md"
    click ENUMS "https://github.com/binance/binance-spot-api-docs/blob/master/enums.md"
    click ENUMS_CN "https://github.com/binance/binance-spot-api-docs/blob/master/enums_CN.md"
    click FILTERS "https://github.com/binance/binance-spot-api-docs/blob/master/filters.md"
    click FILTERS_CN "https://github.com/binance/binance-spot-api-docs/blob/master/filters_CN.md"

    %% Styles
    classDef main fill:#FFD700,stroke:#000,stroke-width:2px
    classDef api fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef ws fill:#90EE90,stroke:#000,stroke-width:2px
    classDef fix fill:#FFB6C1,stroke:#000,stroke-width:2px
    classDef sbe fill:#AFEEEE,stroke:#000,stroke-width:2px
    classDef testnet fill:#F08080,stroke:#000,stroke-width:2px
    classDef faq fill:#FFEFD5,stroke:#000,stroke-width:2px
```
