├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── build_conda.yml │ ├── build_wheels.yml │ ├── codeql.yml │ └── unit-tests.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── dev ├── __init__.py ├── issue │ ├── 45.py │ ├── 46.py │ ├── 46_ext.py │ └── __init__.py ├── link_lib.sh ├── pypi │ ├── create_wheel.sh │ ├── install_packaging_tools.sh │ ├── remove_files.sh │ └── upload_wheel.sh ├── reset.sh ├── set_version.py ├── set_version_config.txt ├── sphinx │ ├── Makefile │ ├── __init__.py │ ├── _static │ │ └── .gitkeep │ ├── create_docs.sh │ ├── install_sphinx.sh │ ├── make.bat │ └── source │ │ ├── __init__.py │ │ ├── _static │ │ └── .gitkeep │ │ ├── changelog.md │ │ ├── code_of_conduct.md │ │ ├── conf.py │ │ ├── contributing.md │ │ ├── index.rst │ │ ├── license.rst │ │ ├── modules.rst │ │ ├── readme.md │ │ ├── security.md │ │ └── unicorn_binance_local_depth_cache.rst ├── test.py ├── test_cache.py ├── test_plain.py ├── test_streams.py ├── ubldc-test-yt.py └── unlink_lib.sh ├── docs ├── .buildinfo ├── .nojekyll ├── CNAME ├── _modules │ ├── index.html │ └── unicorn_binance_local_depth_cache │ │ ├── cluster.html │ │ ├── cluster_endpoints.html │ │ ├── exceptions.html │ │ └── manager.html ├── _sources │ ├── changelog.md.txt │ ├── code_of_conduct.md.txt │ ├── contributing.md.txt │ ├── copyright.rst.txt │ ├── index.rst.txt │ ├── license.rst.txt │ ├── modules.rst.txt │ ├── readme.md.txt │ ├── security.md.txt │ └── unicorn_binance_local_depth_cache.rst.txt ├── _static │ ├── basic.css │ ├── caret-down.svg │ ├── classic.css │ ├── copybutton.js │ ├── default.css │ ├── doctools.js │ ├── documentation_options.js │ ├── file.png │ ├── github-logo.png │ ├── icons8-facebook-20.png │ ├── icons8-github-20.png │ ├── icons8-linkedin-20.png │ ├── icons8-medium-monogram-20.png │ ├── icons8-twitter-20.png │ ├── icons8-xing-20.png │ ├── icons8-youtube-20.png │ ├── jquery-3.5.1.js │ ├── jquery.js │ ├── language_data.js │ ├── lucit.png │ ├── menu.js │ ├── minus.png │ ├── plus.png │ ├── py.png │ ├── py.svg │ ├── pydoctheme.css │ ├── pygments.css │ ├── searchbox.html │ ├── searchtools.js │ ├── sidebar.js │ ├── sphinx_highlight.js │ ├── underscore-1.13.1.js │ └── underscore.js ├── changelog.html ├── code_of_conduct.html ├── contributing.html ├── copyright.html ├── genindex.html ├── index.html ├── license.html ├── modules.html ├── objects.inv ├── py-modindex.html ├── readme.html ├── search.html ├── searchindex.js ├── security.html └── unicorn_binance_local_depth_cache.html ├── environment.yml ├── examples ├── README.md ├── binance_depthcache_limit_count │ ├── README.md │ ├── binance_depthcache_limit_count.py │ └── requirements.txt ├── binance_depthcache_multi_markets │ ├── README.md │ ├── binance_depthcache_multi_markets.py │ └── requirements.txt ├── binance_depthcache_threshold_volume │ ├── README.md │ ├── binance_depthcache_threshold_volume.py │ └── requirements.txt ├── binance_futures_depthcache │ ├── README.md │ ├── binance_futures_depthcache.py │ └── requirements.txt ├── binance_us_depthcache │ ├── README.md │ ├── binance_us_depthcache.py │ └── requirements.txt ├── ubldc-demo │ ├── README.md │ ├── requirements.txt │ └── ubldc-demo.py ├── ubldc_package_update_check │ ├── README.md │ ├── requirements.txt │ └── ubldc_package_update_check.py └── unicorn_depthcache_cluster_for_binance │ ├── .env-example │ ├── README.md │ ├── create-depthcaches-async.py │ ├── create-depthcaches-sequential-async.py │ ├── create-depthcaches-sequential.py │ ├── create-depthcaches.py │ ├── get-cluster-info-async.py │ ├── get-cluster-info.py │ ├── requirements.txt │ ├── stop-all-depthcaches-async.py │ ├── stop-all-depthcaches.py │ ├── submit-license-async.py │ ├── submit-license.py │ ├── test-all-depthcaches-async.py │ ├── test-all-depthcaches-long-term-async.py │ ├── test-all-depthcaches-long-term.py │ ├── test-all-depthcaches.py │ └── ubdcc-demo.py ├── images ├── logo │ ├── LUCIT-UBLDC-Banner-Readme.png │ ├── LUCIT-UBLDC-Logo-Big.png │ ├── LUCIT-UBLDC-Logo.ai │ └── LUCIT-UBLDC-Logo.png └── misc │ ├── heart.png │ ├── icinga.png │ ├── ipython.png │ ├── ok-icon.png │ ├── star.png │ ├── thumbup.png │ ├── watch.png │ └── x-icon.png ├── meta.yaml ├── pyproject.toml ├── requirements.txt ├── setup.py ├── unicorn_binance_local_depth_cache ├── __init__.py ├── cluster.py ├── cluster_endpoints.py ├── exceptions.py ├── licensing_exceptions.py ├── licensing_manager.py └── manager.py └── unittest_binance_local_depth_cache.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ["https://shop.lucit.services"] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Report a bug with this library. 3 | labels: bug 4 | assignees: 5 | - oliver-zehentleitner 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Please post here only issues concerning this repository and follow the [Issue-Guidelines](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/wiki/Issue-Guidelines). 11 | 12 | Most of these fields are not mandatory, but please provide as much information as possible. 13 | 14 | - type: checkboxes 15 | id: Confirmation 16 | attributes: 17 | label: Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library. 18 | description: | 19 | I have searched for other Issues with the same problem or similar feature requests and have looked in the documentation. This issue also affects the latest version of this library. 20 | options: 21 | - label: I checked the documentation and other Issues. I am using the latest version of this library. 22 | required: true 23 | 24 | - type: textarea 25 | id: Version 26 | attributes: 27 | label: Version of this library. 28 | description: | 29 | Please control what version you are using with [this script](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/blob/master/tools/get_versions_of_unicorn_packages.py) and post the output: 30 | validations: 31 | required: true 32 | 33 | - type: dropdown 34 | id: Hardware 35 | attributes: 36 | label: Hardware? 37 | description: | 38 | In which hardware environment is the code executed? 39 | options: 40 | - Local server/workstation 41 | - Raspberry Pi 42 | - VPS or other cloud hosting 43 | validations: 44 | required: true 45 | 46 | - type: dropdown 47 | id: OS 48 | attributes: 49 | label: Operating System? 50 | description: | 51 | In which operating system is the code executed? 52 | options: 53 | - Linux 54 | - macOS 55 | - Windows 56 | - Other (please explain) 57 | validations: 58 | required: true 59 | 60 | - type: dropdown 61 | id: Python 62 | attributes: 63 | label: Python version? 64 | description: | 65 | In which Python version is the code executed? 66 | options: 67 | - Python3.7 68 | - Python3.8 69 | - Python3.9 70 | - Python3.10 71 | - Python3.11 72 | - Python3.12 73 | validations: 74 | required: true 75 | 76 | - type: textarea 77 | id: WheelInfo 78 | attributes: 79 | label: Installed wheel files 80 | description: | 81 | Please share your installed wheel files of this library. Run `pip show unicorn-binance-local-depth-cache --files | 82 | grep ' '` or `conda list -f unicorn-binance-local-depth-cache | grep ' '` and post the result: 83 | render: shell 84 | validations: 85 | required: false 86 | 87 | - type: textarea 88 | id: Packages 89 | attributes: 90 | label: Installed packages 91 | description: | 92 | Please share your installed packages by running `pip list` or `conda list` and entering the output below: 93 | render: shell 94 | validations: 95 | required: false 96 | 97 | - type: textarea 98 | id: Log 99 | attributes: 100 | label: Logging output 101 | description: | 102 | Please share the logging output here (REMOVE API_KEY, API_SECRET, LISTEN_KEY!!): 103 | _Note:_ This will be automatically formatted as code. 104 | placeholder: "logfile" 105 | render: shell 106 | validations: 107 | required: false 108 | 109 | - type: dropdown 110 | id: Endpoint 111 | attributes: 112 | label: Used endpoint? 113 | description: | 114 | To which endpoint do you connect? 115 | options: 116 | - concerns all 117 | - binance.com 118 | - binance.com-coin_futures 119 | - binance.com-futures 120 | - binance.com-futures-testnet 121 | - binance.com-isolated_margin 122 | - binance.com-isolated_margin-testnet 123 | - binance.com-margin 124 | - binance.com-margin-testnet 125 | - binance.com-testnet 126 | - binance.us 127 | - trbinance.com 128 | validations: 129 | required: true 130 | 131 | - type: textarea 132 | id: Issue 133 | attributes: 134 | label: Issue 135 | description: | 136 | Please describe the issue you are experiencing: 137 | validations: 138 | required: true 139 | 140 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: UNICORN Devs Chat 4 | url: https://t.me/unicorndevs 5 | about: Chat to us about the UNICORN Binance Local Depth Cache and ask general questions. 6 | - name: UNICORN Binance Local Depth Cache Discussions 7 | url: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/discussions 8 | about: Ask general questions. 9 | - name: UNICORN Binance Local Depth Cache documentation 10 | url: https://unicorn-binance-local-depth-cache.docs.lucit.tech/ 11 | about: The complete UNICORN Binance Local Depth Cache documentation. 12 | - name: Get Professional and Fast Support 13 | url: https://www.lucit.tech/get-support.html 14 | about: Contact the LUCIT Development Team. 15 | - name: Get a UNICORN Binance Suite License 16 | url: https://shop.lucit.services/software/unicorn-binance-suite 17 | about: LUCIT Online Shop -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this library. 3 | labels: enhancement 4 | assignees: 5 | - oliver-zehentleitner 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Please post here only issues concerning this repository and follow the [Issue-Guidelines](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/wiki/Issue-Guidelines). 11 | 12 | Most of these fields are not mandatory, but please provide as much information as possible. 13 | - type: textarea 14 | id: Problem 15 | attributes: 16 | label: Is your feature request related to a problem? Please describe. 17 | description: | 18 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 19 | placeholder: 20 | validations: 21 | required: false 22 | 23 | - type: textarea 24 | id: Solution 25 | attributes: 26 | label: Describe the solution you'd like. 27 | description: | 28 | A clear and concise description of what you want to happen. 29 | placeholder: 30 | validations: 31 | required: false 32 | 33 | - type: textarea 34 | id: Alternatives 35 | attributes: 36 | label: Describe alternatives you've considered 37 | description: | 38 | A clear and concise description of any alternative solutions or features you've considered. 39 | placeholder: 40 | validations: 41 | required: false 42 | 43 | - type: textarea 44 | id: Additional 45 | attributes: 46 | label: Additional context 47 | description: | 48 | Add any other context or screenshots about the feature request here. 49 | placeholder: 50 | validations: 51 | required: false 52 | 53 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | # https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/enabling-and-disabling-version-updates 6 | 7 | version: 2 8 | updates: 9 | - package-ecosystem: "pip" 10 | directory: "/" 11 | schedule: 12 | interval: "daily" 13 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # PR Details 2 | 3 | 4 | 5 | ## Description 6 | 7 | 8 | 9 | ## Related Issue 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## Motivation and Context 17 | 18 | 19 | 20 | ## How Has This Been Tested 21 | 22 | 23 | 24 | 25 | 26 | ## Types of changes 27 | 28 | 29 | 30 | - [ ] Docs change / refactoring / dependency upgrade 31 | - [ ] Bug fix (non-breaking change which fixes an issue) 32 | - [ ] New feature (non-breaking change which adds functionality) 33 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 34 | 35 | ## Checklist 36 | 37 | 38 | 39 | 40 | - [ ] My code follows the code style of this project. 41 | - [ ] My change requires a change to the documentation. 42 | - [ ] I have updated the documentation accordingly. 43 | - [ ] I have read the 44 | **[CONTRIBUTING](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/CONTRIBUTING.md)** 45 | document. 46 | - [ ] I have added tests to cover my changes. 47 | - [ ] All new and existing tests passed. 48 | -------------------------------------------------------------------------------- /.github/workflows/build_conda.yml: -------------------------------------------------------------------------------- 1 | name: Build and Publish Anaconda 2 | 3 | on: 4 | workflow_dispatch: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build_conda_packages: 10 | name: Build conda on ${{ matrix.os }} with Python ${{ matrix.python-version }} 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | fail-fast: true 14 | matrix: 15 | os: [ubuntu-20.04, windows-2022, macos-12] 16 | python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] 17 | exclude: 18 | - os: windows-2022 19 | python-version: "3.12" 20 | steps: 21 | - uses: actions/checkout@v4 22 | - name: Conda environment creation and activation 23 | uses: conda-incubator/setup-miniconda@v3 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | environment-file: environment.yml 27 | auto-update-conda: false 28 | auto-activate-base: false 29 | show-channel-urls: true 30 | 31 | - name: Install Conda Tools 32 | run: | 33 | conda update --all 34 | conda install -c conda-forge conda-build 35 | conda install conda-verify 36 | conda install -c anaconda anaconda-client 37 | 38 | - name: Configure PATH 39 | run: echo "$CONDA/bin" >> $GITHUB_PATH 40 | 41 | - name: Install Python Tools 42 | run: | 43 | pip install setuptools wheel --upgrade 44 | 45 | - name: Install macOS SDK (only on macOS) 46 | if: runner.os == 'macOS' 47 | run: | 48 | sudo mkdir -p /opt/MacOSX10.10.sdk 49 | sudo curl -L -o MacOSX10.10.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.10.sdk.tar.xz 50 | sudo tar -xJf MacOSX10.10.sdk.tar.xz -C /opt/ 51 | 52 | - name: Set CONDA_BUILD_SYSROOT (only on macOS) 53 | if: runner.os == 'macOS' 54 | run: | 55 | echo "CONDA_BUILD_SYSROOT: /opt/MacOSX10.10.sdk # [osx]" >> conda_build_config.yaml 56 | 57 | - name: Set Compiler Flags for Windows in conda_build_config.yaml 58 | if: runner.os == 'Windows' 59 | run: | 60 | echo "CFLAGS:" >> conda_build_config.yaml 61 | echo " - '/O2 /GL' # [win]" >> conda_build_config.yaml 62 | echo " - '/MP' # [win]" >> conda_build_config.yaml 63 | echo " - '/W3' # [win]" >> conda_build_config.yaml 64 | echo "" >> conda_build_config.yaml 65 | echo "LDFLAGS:" >> conda_build_config.yaml 66 | echo " - '/INCREMENTAL:NO' # [win]" >> conda_build_config.yaml 67 | echo " - '/LTCG' # [win]" >> conda_build_config.yaml 68 | echo "" >> conda_build_config.yaml 69 | echo "c_compiler:" >> conda_build_config.yaml 70 | echo " - vs2022 # [win]" >> conda_build_config.yaml 71 | echo "" >> conda_build_config.yaml 72 | 73 | - name: Install Visual Studio Build Tools and Windows SDK (Windows only) 74 | if: runner.os == 'Windows' 75 | run: | 76 | choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional" 77 | choco install windows-sdk-10.0 --version=10.0.22621.0 78 | choco install visualcpp-build-tools -y 79 | setx CMAKE_GENERATOR "Visual Studio 17 2022" /M 80 | setx DISTUTILS_USE_SDK 1 81 | setx MSSdk 1 82 | setx INCLUDE "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" 83 | setx LIB "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64" 84 | 85 | - name: Locate Visual Studio with vswhere 86 | if: runner.os == 'Windows' 87 | shell: cmd 88 | run: | 89 | "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 90 | 91 | - name: Setup Visual Studio Environment (Windows only) 92 | if: runner.os == 'Windows' 93 | shell: cmd 94 | run: | 95 | for /f "delims=" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath') do set "VSPATH=%%i" 96 | echo Visual Studio Path: %VSPATH% 97 | call "%VSPATH%\VC\Auxiliary\Build\vcvars64.bat" 98 | 99 | - name: "conda search: lucit::" 100 | run: | 101 | conda config --add channels conda-forge 102 | conda config --add channels lucit 103 | conda config --show channels 104 | conda search lucit::lucit-licensing-python 105 | conda search lucit::unicorn-binance-rest-api 106 | conda search lucit::unicorn-binance-websocket-api 107 | conda search lucit::unicorn-fy 108 | 109 | - name: Build and upload the conda packages 110 | uses: uibcdf/action-build-and-upload-conda-packages@v1.3.0 111 | with: 112 | meta_yaml_dir: . 113 | overwrite: False 114 | python-version: ${{ matrix.python-version }} 115 | user: lucit 116 | label: main 117 | token: ${{ secrets.ANACONDA_API_TOKEN }} 118 | env: 119 | PIP_VERBOSE: 0 120 | CONDA_VERBOSITY: 0 121 | -------------------------------------------------------------------------------- /.github/workflows/build_wheels.yml: -------------------------------------------------------------------------------- 1 | name: Build and Publish GH+PyPi 2 | 3 | on: 4 | workflow_dispatch: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build_wheels: 10 | name: Build wheels on ${{ matrix.os }} 11 | runs-on: ${{ matrix.os }} 12 | env: 13 | CIBW_SKIP: "pp36-* pp37-* pp38-*" 14 | strategy: 15 | matrix: 16 | os: [ubuntu-20.04, windows-2019, macos-12] 17 | steps: 18 | - name: GitHub Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Upgrade pip 22 | run: python -m pip install --upgrade pip 23 | 24 | - name: Set up Environment 25 | run: echo "CIBW_SKIP=pp36-* pp37-*" >> $GITHUB_ENV 26 | 27 | - name: Check ENV 28 | if: matrix.os == 'ubuntu-20.04' 29 | run: echo $PATH 30 | 31 | - name: Build wheels Linux 32 | if: matrix.os == 'ubuntu-20.04' 33 | uses: pypa/cibuildwheel@v2.16.5 34 | 35 | - name: Build wheels Mac 36 | if: matrix.os == 'macos-12' 37 | uses: pypa/cibuildwheel@v2.16.5 38 | 39 | - name: Build wheels Windows 40 | if: matrix.os == 'windows-2019' 41 | uses: pypa/cibuildwheel@v2.16.5 42 | 43 | - name: Upload Artifacts 44 | uses: actions/upload-artifact@v4 45 | with: 46 | path: ./wheelhouse/*.whl 47 | overwrite: true 48 | 49 | build_sdist: 50 | name: Build source distribution 51 | runs-on: ubuntu-latest 52 | steps: 53 | - name: GitHub Checkout 54 | uses: actions/checkout@v4 55 | 56 | - name: Build sdist 57 | run: pipx run build --sdist 58 | 59 | - name: Upload Artifacts 60 | uses: actions/upload-artifact@v4 61 | with: 62 | path: dist/*.tar.gz 63 | overwrite: true 64 | 65 | Release: 66 | needs: [build_wheels, build_sdist] 67 | runs-on: ubuntu-latest 68 | environment: pypi 69 | permissions: 70 | contents: write 71 | discussions: write 72 | id-token: write 73 | steps: 74 | - name: Download Artifacts 75 | uses: actions/download-artifact@v4 76 | with: 77 | name: artifact 78 | path: dist 79 | 80 | - name: Create GitHub Release 81 | uses: softprops/action-gh-release@v2 82 | with: 83 | body: | 84 | Please read the [CHANGELOG](https://unicorn-binance-local-depth-cache.docs.lucit.tech/changelog.html) for further information. 85 | discussion_category_name: releases 86 | draft: false 87 | files: | 88 | dist/*.tar.gz 89 | dist/*.whl 90 | generate_release_notes: true 91 | name: unicorn-binance-local-depth-cache 92 | prerelease: false 93 | tag_name: 2.8.0 94 | token: ${{ secrets.GITHUB_TOKEN }} 95 | 96 | - name: Create PyPi Release 97 | uses: pypa/gh-action-pypi-publish@release/v1 -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '25 9 * * 6' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'python' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v2 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v1 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 52 | 53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 54 | # If this step fails, then you should remove it and run the build manually (see below) 55 | - name: Autobuild 56 | uses: github/codeql-action/autobuild@v1 57 | 58 | # ℹ️ Command-line programs to run using the OS shell. 59 | # 📚 https://git.io/JvXDl 60 | 61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 62 | # and modify them (or add more) to build your code if your project 63 | # uses a compiled language 64 | 65 | #- run: | 66 | # make bootstrap 67 | # make release 68 | 69 | - name: Perform CodeQL Analysis 70 | uses: github/codeql-action/analyze@v1 71 | -------------------------------------------------------------------------------- /.github/workflows/unit-tests.yml: -------------------------------------------------------------------------------- 1 | name: Unit Tests 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | test_python_3_8: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: GitHub Checkout 14 | uses: actions/checkout@v4 15 | 16 | - uses: actions/setup-python@v4 17 | with: 18 | python-version: 3.8 19 | 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -r requirements.txt 24 | pip install coveralls 25 | 26 | - name: Unit test 27 | env: 28 | LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }} 29 | LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }} 30 | run: coverage run --source unicorn_binance_local_depth_cache unittest_binance_local_depth_cache.py 31 | 32 | test_python_3_9: 33 | runs-on: ubuntu-latest 34 | steps: 35 | - name: GitHub Checkout 36 | uses: actions/checkout@v4 37 | 38 | - uses: actions/setup-python@v4 39 | with: 40 | python-version: 3.9 41 | 42 | - name: Install dependencies 43 | run: | 44 | python -m pip install --upgrade pip 45 | pip install -r requirements.txt 46 | pip install coveralls 47 | 48 | - name: Unit test 49 | env: 50 | LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }} 51 | LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }} 52 | run: coverage run --source unicorn_binance_local_depth_cache unittest_binance_local_depth_cache.py 53 | 54 | test_python_3_10: 55 | runs-on: ubuntu-latest 56 | steps: 57 | - name: GitHub Checkout 58 | uses: actions/checkout@v4 59 | 60 | - uses: actions/setup-python@v4 61 | with: 62 | python-version: "3.10" 63 | 64 | - name: Install dependencies 65 | run: | 66 | python -m pip install --upgrade pip 67 | pip install -r requirements.txt 68 | pip install coveralls 69 | 70 | - name: Unit test 71 | env: 72 | LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }} 73 | LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }} 74 | run: coverage run --source unicorn_binance_local_depth_cache unittest_binance_local_depth_cache.py 75 | 76 | test_python_3_11: 77 | runs-on: ubuntu-latest 78 | steps: 79 | - name: GitHub Checkout 80 | uses: actions/checkout@v4 81 | 82 | - uses: actions/setup-python@v4 83 | with: 84 | python-version: "3.11" 85 | 86 | - name: Install dependencies 87 | run: | 88 | python -m pip install --upgrade pip 89 | pip install -r requirements.txt 90 | pip install coveralls 91 | 92 | - name: Unit test 93 | env: 94 | LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }} 95 | LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }} 96 | run: coverage run --source unicorn_binance_local_depth_cache unittest_binance_local_depth_cache.py 97 | 98 | test_python_3_12: 99 | runs-on: ubuntu-latest 100 | steps: 101 | - name: GitHub Checkout 102 | uses: actions/checkout@v4 103 | 104 | - uses: actions/setup-python@v4 105 | with: 106 | python-version: "3.12" 107 | 108 | - name: Install dependencies 109 | run: | 110 | python -m pip install --upgrade pip 111 | pip install -r requirements.txt 112 | pip install coveralls 113 | 114 | - name: Unit test 115 | env: 116 | LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }} 117 | LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }} 118 | run: coverage run --source unicorn_binance_local_depth_cache unittest_binance_local_depth_cache.py 119 | 120 | - name: Upload coverage to Codecov 121 | uses: codecov/codecov-action@v3 122 | with: 123 | token: ${{ secrets.CODECOV_TOKEN }} 124 | flags: unittests 125 | name: codecov-umbrella 126 | verbose: true 127 | 128 | 129 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | 3 | dev/unicorn_binance_local_depth_cache 4 | examples/unicorn_depthcache_cluster_for_binance/unicorn_binance_local_depth_cache 5 | 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | *.c 14 | *.pyi 15 | 16 | # Distribution / packaging 17 | .Python 18 | build/ 19 | stubs/ 20 | develop-eggs/ 21 | dist/ 22 | downloads/ 23 | eggs/ 24 | .eggs/ 25 | lib/ 26 | lib64/ 27 | parts/ 28 | sdist/ 29 | var/ 30 | wheels/ 31 | *.egg-info/ 32 | .installed.cfg 33 | *.egg 34 | MANIFEST 35 | 36 | # PyInstaller 37 | # Usually these files are written by a python script from a template 38 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 39 | *.manifest 40 | *.spec 41 | 42 | # Installer logs 43 | pip-log.txt 44 | pip-delete-this-directory.txt 45 | 46 | # Unit test / coverage reports 47 | htmlcov/ 48 | .tox/ 49 | .coverage 50 | .coverage.* 51 | .cache 52 | nosetests.xml 53 | coverage.xml 54 | *.cover 55 | .hypothesis/ 56 | .pytest_cache/ 57 | 58 | # Translations 59 | *.mo 60 | *.pot 61 | 62 | # Django stuff: 63 | *.log 64 | local_settings.py 65 | db.sqlite3 66 | 67 | # Flask stuff: 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff: 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | target/ 79 | 80 | # Jupyter Notebook 81 | .ipynb_checkpoints 82 | 83 | # pyenv 84 | .python-version 85 | 86 | # celery beat schedule file 87 | celerybeat-schedule 88 | 89 | # SageMath parsed files 90 | *.sage.py 91 | 92 | # Environments 93 | examples/unicorn_depthcache_cluster_for_binance/.env 94 | .venv 95 | env/ 96 | venv/ 97 | ENV/ 98 | env.bak/ 99 | venv.bak/ 100 | 101 | # Spyder project settings 102 | .spyderproject 103 | .spyproject 104 | 105 | # Rope project settings 106 | .ropeproject 107 | 108 | # mkdocs documentation 109 | /site 110 | 111 | # mypy 112 | .mypy_cache/ 113 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at https://www.lucit.tech/contact-unicorn-developers.html. 59 | All complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via 4 | [issue](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues/new/choose) 5 | with the owners of this repository before making a change. 6 | 7 | Please note we have a 8 | [code of conduct](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/CODE_OF_CONDUCT.md), 9 | please follow it in all your interactions with the project. 10 | 11 | ## Pull Request Process 12 | 13 | 1. Discuss with owners 14 | 2. Fork 15 | 3. Contribute 16 | 4. Fulfill and confirm requirements of the pull request 17 | 5. Trigger the pull request -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LSOSL - LUCIT Synergetic Open Source License 2 | ============================================ 3 | 4 | Version 1.0, November 2023 5 | 6 | 1. INTRODUCTION 7 | 2. PROJECT INFORMATION 8 | 3. LICENSE CONDITIONS AND VERIFICATION 9 | 4. LICENSE PURCHASE 10 | 5. CONTRIBUTING CODE 11 | 6. USAGE AND DISTRIBUTION 12 | 7. DATA COLLECTION AND LICENSE CONTROL 13 | 8. THIRD-PARTY SOFTWARE 14 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 15 | 10. CHANGES TO LICENSE TERMS 16 | 17 | ------------------------------------------------------------------------------------------------------------------------ 18 | 19 | 1. INTRODUCTION 20 | 21 | The "LUCIT Synergetic Open Source License" oversees the utilization and distribution of the UNICORN Binance Local Depth 22 | Cache, a part of the UNICORN Binance Suite by LUCIT IT-Management GmbH. This API enables the effortless integration of 23 | Binance features into diverse applications. 24 | 25 | 26 | 2. PROJECT INFORMATION 27 | 28 | - Project name: UNICORN Binance Local Depth Cache 29 | - Project page: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 30 | - GitHub repository: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 31 | - PyPI repository: https://pypi.org/project/unicorn-binance-local-depth-cache 32 | - Get a license: https://shop.lucit.services/software 33 | 34 | 35 | 3. LICENSE CONDITIONS AND VERIFICATION 36 | 37 | The use of UNICORN Binance Local Depth Cache requires a license key and an API secret. 38 | 39 | Licenses are available at: https://shop.lucit.services/software 40 | 41 | Verification is done via a client-side module that forwards the license details to our backend for validation. 42 | The software may be used and distributed without restriction, the only condition is that the execution requires a valid 43 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 44 | 45 | For transparency, our licensing client module is available on GitHub: 46 | https://github.com/LUCIT-Systems-and-Development/lucit-licensing-python 47 | 48 | 49 | 4. LICENSE PURCHASE 50 | 51 | Usage of the our software necessitates obtaining a license from the LUCIT Online Shop. 52 | 53 | More details can be found at: https://shop.lucit.services/software 54 | 55 | 56 | 5. CONTRIBUTING CODE 57 | 58 | Contributions via GitHub pull requests are welcome. However, contributors should be aware that submitted code 59 | automatically becomes LUCIT IT-Management GmbH's property and copyright. 60 | 61 | 62 | 6. USAGE AND DISTRIBUTION 63 | 64 | The LSOSL licensed projects of LUCIT IT-Management GmbH can be used and integrated into any application without 65 | restriction and distributed as desired. The only condition is that the execution of our software requires a valid 66 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 67 | 68 | For information on library versions that do not contain a license requirement, please contact: sales@lucit.tech 69 | 70 | 71 | 7. DATA COLLECTION AND LICENSE CONTROL 72 | 73 | For license adherence, test license misuse prevention, API rate monitoring, and service improvement, we gather: 74 | 75 | - User IP addresses 76 | - Instance log data 77 | - Used Python version 78 | - Operating system type 79 | - API usage rates 80 | - MAC addresses (for misuse detection) 81 | - Data volume processed (anonymously aggregated) 82 | 83 | This data is stored only for its intended purpose and duration, except for anonymous statistics. We commit to 84 | confidentiality and non-disclosure. Details are in our privacy policy. 85 | 86 | 87 | 8. THIRD-PARTY SOFTWARE 88 | 89 | The software may embed third-party code or libraries, each governed by their respective licenses. Ensure awareness and 90 | compliance when using the software. 91 | 92 | 93 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 94 | 95 | The software is rendered "as is", sans any assurances. LUCIT IT-Management GmbH disclaims liability for any potential 96 | repercussions arising from software usage. 97 | 98 | 99 | 10. CHANGES TO LICENSE TERMS 100 | 101 | LUCIT IT-Management GmbH reserves the right to modify, alter, or update the terms of this license at any time and at 102 | its sole discretion. Users are encouraged to review the license terms regularly to ensure compliance. 103 | 104 | ------------------------------------------------------------------------------------------------------------------------ 105 | 106 | Thank you for selecting the UNICORN Binance Local Depth Cache and products from LUCIT IT-Management GmbH. We deeply value 107 | your trust in our technologies. 108 | 109 | LUCIT IT-Management GmbH - Am Berg 391, 3970 Weitra, AUSTRIA - https://www.lucit.tech -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policies and Procedures 2 | This document outlines security procedures and general policies for the 3 | `unicorn-binance-local-depth-cache` project. 4 | 5 | * [Reporting a Bug](#reporting-a-bug) 6 | * [Disclosure Policy](#disclosure-policy) 7 | * [Comments on this Policy](#comments-on-this-policy) 8 | 9 | ## Reporting a Bug 10 | `LUCIT Systems and Development` takes all security bugs in `unicorn-binance-local-depth-cache` seriously. 11 | Thank you for improving the security of `unicorn-binance-local-depth-cache`. We appreciate your 12 | efforts and responsible disclosure and will make every effort to acknowledge your contributions. 13 | 14 | Report security bugs via our contact form: 15 | https://www.lucit.tech/contact-unicorn-developers.html 16 | 17 | The lead maintainer will acknowledge your email within 48 hours, and will send a 18 | more detailed response within 48 hours indicating the next steps in handling 19 | your report. After the initial reply to your report, the security team will 20 | endeavor to keep you informed of the progress towards a fix and full 21 | announcement, and may ask for additional information or guidance. 22 | 23 | Report security bugs in third-party modules to the person or team maintaining 24 | the module. 25 | 26 | ## Disclosure Policy 27 | When the security team receives a security bug report, they will assign it to a 28 | primary handler. This person will coordinate the fix and release process, 29 | involving the following steps: 30 | 31 | * Confirm the problem and determine the affected versions. 32 | * Audit code to find any potential similar problems. 33 | * Prepare fixes for all releases still under maintenance. These fixes will be 34 | released as fast as possible to pip. 35 | 36 | ## Comments on this Policy 37 | If you have suggestions on how this process could be improved please submit a 38 | pull request. 39 | -------------------------------------------------------------------------------- /dev/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/__init__.py -------------------------------------------------------------------------------- /dev/issue/45.py: -------------------------------------------------------------------------------- 1 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 2 | import time 3 | import logging 4 | 5 | logging.basicConfig(level=logging.ERROR) 6 | 7 | coin = "BTCUSDT" 8 | 9 | ubldc = BinanceLocalDepthCacheManager(exchange="binance.com-futures", depth_cache_update_interval=100) 10 | ubldc.create_depthcache(coin) 11 | time.sleep(4) 12 | while True: 13 | try: 14 | try: 15 | asks = ubldc.get_asks(coin) 16 | bids = ubldc.get_bids(coin) 17 | except DepthCacheOutOfSync: 18 | asks = "Out of sync!" 19 | bids = "Out of sync!" 20 | print(f"Bids: {len(bids)}, asks: {len(asks)}") 21 | time.sleep(1) 22 | except KeyboardInterrupt as k: 23 | print(k) 24 | ubldc.stop_manager() 25 | print(f"finished") 26 | exit() 27 | -------------------------------------------------------------------------------- /dev/issue/46.py: -------------------------------------------------------------------------------- 1 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager 2 | import time 3 | 4 | ubldc = BinanceLocalDepthCacheManager(exchange="binance.com-futures", depth_cache_update_interval=100) 5 | coins = ['ethusdt', 'DYDXUSDT', "ALGOUSDT", "btcusdt"] 6 | ubldc.create_depthcache(coins) 7 | print(f"DCs created ...") 8 | time.sleep(4) 9 | ubldc.stop_depthcache("btcusdt") 10 | print(f"DC stopped ...") 11 | time.sleep(4) 12 | ubldc.stop_manager() 13 | print(f"finished") 14 | -------------------------------------------------------------------------------- /dev/issue/46_ext.py: -------------------------------------------------------------------------------- 1 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 2 | import time 3 | 4 | 5 | coins = ['ethusdt', 'DYDXUSDT', "ALGOUSDT", "btcusdt"] 6 | test_coin = "btcusdt" 7 | 8 | with BinanceLocalDepthCacheManager(exchange="binance.com-futures", 9 | init_interval=0.5, 10 | init_time_window=1, 11 | depth_cache_update_interval=100) as ubldc: 12 | ubldc.create_depthcache(coins) 13 | print(f"DCs created: {coins}") 14 | time.sleep(1) 15 | ubldc.stop_depthcache(test_coin) 16 | print(f"DC {test_coin} stopped ...") 17 | time.sleep(1) 18 | print(f"list_of_depthcaches: {ubldc.get_list_of_depthcaches()}") 19 | print(f"Restart {test_coin}:") 20 | ubldc.create_depthcache(test_coin) 21 | time.sleep(1) 22 | sigterm = False 23 | print(f"Looking for asks:") 24 | while sigterm is False: 25 | try: 26 | time.sleep(0.1) 27 | print(f"ASKS '{test_coin}': {ubldc.get_asks(test_coin, limit_count=3)}") 28 | except DepthCacheOutOfSync: 29 | print("Please wait till the DC gets synced!") 30 | except KeyboardInterrupt: 31 | sigterm = True 32 | print(f"finished") 33 | -------------------------------------------------------------------------------- /dev/issue/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/issue/__init__.py -------------------------------------------------------------------------------- /dev/link_lib.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | cd dev 4 | ln -s ../unicorn_binance_local_depth_cache -------------------------------------------------------------------------------- /dev/pypi/create_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Part of ‘UNICORN Binance Local Depth Cache’ 5 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 6 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 7 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 8 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 9 | # LUCIT Online Shop: https://shop.lucit.services/software 10 | # 11 | # License: LSOSL - LUCIT Synergetic Open Source License 12 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 13 | # 14 | # Author: LUCIT Systems and Development 15 | # 16 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 17 | # All rights reserved. 18 | 19 | security-check() { 20 | echo -n "Did you change the version in \`CHANGELOG.md\` and used \`dev/set_version.py\`? [yes|NO] " 21 | local SURE 22 | read SURE 23 | if [ "$SURE" != "yes" ]; then 24 | exit 1 25 | fi 26 | echo "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/actions/workflows/build_wheels.yml" 27 | echo "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/actions/workflows/build_conda.yml" 28 | } 29 | 30 | compile-check() { 31 | echo -n "Compile local? [yes|NO] " 32 | local SURE 33 | read SURE 34 | if [ "$SURE" != "yes" ]; then 35 | exit 1 36 | fi 37 | echo "ok, lets go ..." 38 | python3 setup.py bdist_wheel sdist 39 | } 40 | 41 | security-check 42 | compile-check 43 | -------------------------------------------------------------------------------- /dev/pypi/install_packaging_tools.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: pypi/install_packaging_tools.sh 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | python3 -m pip install --user --upgrade pip setuptools wheel twine tqdm 22 | -------------------------------------------------------------------------------- /dev/pypi/remove_files.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: pypi/remove_files.sh 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | rm ./build -r 22 | rm ./dist -r 23 | rm ./unicorn_binance_local_depth_cache.egg-info -r 24 | -------------------------------------------------------------------------------- /dev/pypi/upload_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: pypi/upload_wheel.sh 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | # 21 | # create this file: 22 | # ~/.pypirc 23 | 24 | 25 | python3 -m twine upload dist/* 26 | -------------------------------------------------------------------------------- /dev/reset.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | rm *.log 4 | rm *.py.log 5 | rm *.c 6 | rm dev/*.log 7 | 8 | rm build -r 9 | rm dist -r 10 | rm *.egg-info -r 11 | rm stubs -r 12 | rm out -r 13 | 14 | rm unicorn_binance_local_depth_cache/*.c 15 | rm unicorn_binance_local_depth_cache/*.cpp 16 | rm unicorn_binance_local_depth_cache/*.html 17 | rm unicorn_binance_local_depth_cache/*.dll 18 | rm unicorn_binance_local_depth_cache/*.so 19 | rm unicorn_binance_local_depth_cache/*.pyi 20 | -------------------------------------------------------------------------------- /dev/set_version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: dev/set_version.sh 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | import sys 22 | 23 | 24 | def replace_string_in_files(replace_string, 25 | config_file_path="./dev/set_version_config.txt", 26 | log_file_path="./dev/set_version.log"): 27 | with open(config_file_path, 'r', encoding='utf-8') as config_file: 28 | lines = config_file.readlines() 29 | search_string = lines[0].strip() 30 | file_list = lines[1].strip().split(',') 31 | 32 | for file_path in file_list: 33 | try: 34 | with open(file_path, 'r', encoding='utf-8') as file: 35 | content = file.read() 36 | 37 | content = content.replace(search_string, replace_string) 38 | 39 | with open(file_path, 'w', encoding='utf-8') as file: 40 | file.write(content) 41 | print(f"Replaced in {file_path}") 42 | except FileNotFoundError: 43 | print(f"FileNotFoundError: {file_path}") 44 | except Exception as e: 45 | print(f"Error during editing {file_path}: {e}") 46 | 47 | with open(log_file_path, 'a', encoding='utf-8') as log_file: 48 | log_file.write(f"Replaced: {search_string} with {replace_string}\n") 49 | 50 | with open(config_file_path, 'w', encoding='utf-8') as config_file: 51 | config_file.write(replace_string + '\n' + ','.join(file_list) + '\n') 52 | 53 | 54 | if __name__ == "__main__": 55 | input_replace_string = sys.argv[1] 56 | replace_string_in_files(input_replace_string) 57 | -------------------------------------------------------------------------------- /dev/set_version_config.txt: -------------------------------------------------------------------------------- 1 | 2.8.0 2 | meta.yaml,pyproject.toml,setup.py,README.md,.github/workflows/build_wheels.yml,dev/sphinx/source/conf.py,unicorn_binance_local_depth_cache/manager.py 3 | -------------------------------------------------------------------------------- /dev/sphinx/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = source 8 | BUILDDIR = build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /dev/sphinx/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/sphinx/__init__.py -------------------------------------------------------------------------------- /dev/sphinx/_static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/sphinx/_static/.gitkeep -------------------------------------------------------------------------------- /dev/sphinx/create_docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: dev/sphinx/create_docs.sh 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | rm dev/sphinx/source/changelog.md 22 | rm dev/sphinx/source/code_of_conduct.md 23 | rm dev/sphinx/source/contributing.md 24 | rm dev/sphinx/source/license.rst 25 | rm dev/sphinx/source/readme.md 26 | rm dev/sphinx/source/security.md 27 | 28 | cp CHANGELOG.md dev/sphinx/source/changelog.md 29 | cp CODE_OF_CONDUCT.md dev/sphinx/source/code_of_conduct.md 30 | cp CONTRIBUTING.md dev/sphinx/source/contributing.md 31 | cp LICENSE dev/sphinx/source/license.rst 32 | cp README.md dev/sphinx/source/readme.md 33 | cp SECURITY.md dev/sphinx/source/security.md 34 | 35 | mkdir -vp dev/sphinx/build 36 | 37 | cd dev/sphinx 38 | rm build/html 39 | ln -s ../../../docs build/html 40 | make html -d 41 | echo "Creating CNAME file for GitHub." 42 | echo "unicorn-binance-local-depth-cache.docs.lucit.tech" >> build/html/CNAME 43 | -------------------------------------------------------------------------------- /dev/sphinx/install_sphinx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | python3 -m pip install sphinx --upgrade 3 | python3 -m pip install python-docs-theme-lucit --upgrade 4 | python3 -m pip install rich --upgrade 5 | python3 -m pip install myst-parser --upgrade 6 | python3 -m pip install sphinx-markdown-tables --upgrade -------------------------------------------------------------------------------- /dev/sphinx/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /dev/sphinx/source/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/sphinx/source/__init__.py -------------------------------------------------------------------------------- /dev/sphinx/source/_static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/dev/sphinx/source/_static/.gitkeep -------------------------------------------------------------------------------- /dev/sphinx/source/code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at https://www.lucit.tech/contact-unicorn-developers.html. 59 | All complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /dev/sphinx/source/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via 4 | [issue](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues/new/choose) 5 | with the owners of this repository before making a change. 6 | 7 | Please note we have a 8 | [code of conduct](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/CODE_OF_CONDUCT.md), 9 | please follow it in all your interactions with the project. 10 | 11 | ## Pull Request Process 12 | 13 | 1. Discuss with owners 14 | 2. Fork 15 | 3. Contribute 16 | 4. Fulfill and confirm requirements of the pull request 17 | 5. Trigger the pull request -------------------------------------------------------------------------------- /dev/sphinx/source/index.rst: -------------------------------------------------------------------------------- 1 | .. unicorn-binance-local-depth-cache documentation master file, created by 2 | sphinx-quickstart on Sat Nov 2 14:14:48 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to unicorn-binance-local-depth-cache's documentation! 7 | ============================================================= 8 | 9 | .. toctree:: 10 | :maxdepth: 3 11 | :caption: Contents: 12 | 13 | Readme 14 | Modules 15 | ChangeLog 16 | Code of Conduct 17 | Contributing 18 | License 19 | Security 20 | 21 | 22 | Indices and tables 23 | ================== 24 | * :ref:`genindex` 25 | * :ref:`modindex` 26 | * :ref:`search` 27 | -------------------------------------------------------------------------------- /dev/sphinx/source/license.rst: -------------------------------------------------------------------------------- 1 | LSOSL - LUCIT Synergetic Open Source License 2 | ============================================ 3 | 4 | Version 1.0, November 2023 5 | 6 | 1. INTRODUCTION 7 | 2. PROJECT INFORMATION 8 | 3. LICENSE CONDITIONS AND VERIFICATION 9 | 4. LICENSE PURCHASE 10 | 5. CONTRIBUTING CODE 11 | 6. USAGE AND DISTRIBUTION 12 | 7. DATA COLLECTION AND LICENSE CONTROL 13 | 8. THIRD-PARTY SOFTWARE 14 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 15 | 10. CHANGES TO LICENSE TERMS 16 | 17 | ------------------------------------------------------------------------------------------------------------------------ 18 | 19 | 1. INTRODUCTION 20 | 21 | The "LUCIT Synergetic Open Source License" oversees the utilization and distribution of the UNICORN Binance Local Depth 22 | Cache, a part of the UNICORN Binance Suite by LUCIT IT-Management GmbH. This API enables the effortless integration of 23 | Binance features into diverse applications. 24 | 25 | 26 | 2. PROJECT INFORMATION 27 | 28 | - Project name: UNICORN Binance Local Depth Cache 29 | - Project page: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 30 | - GitHub repository: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 31 | - PyPI repository: https://pypi.org/project/unicorn-binance-local-depth-cache 32 | - Get a license: https://shop.lucit.services/software 33 | 34 | 35 | 3. LICENSE CONDITIONS AND VERIFICATION 36 | 37 | The use of UNICORN Binance Local Depth Cache requires a license key and an API secret. 38 | 39 | Licenses are available at: https://shop.lucit.services/software 40 | 41 | Verification is done via a client-side module that forwards the license details to our backend for validation. 42 | The software may be used and distributed without restriction, the only condition is that the execution requires a valid 43 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 44 | 45 | For transparency, our licensing client module is available on GitHub: 46 | https://github.com/LUCIT-Systems-and-Development/lucit-licensing-python 47 | 48 | 49 | 4. LICENSE PURCHASE 50 | 51 | Usage of the our software necessitates obtaining a license from the LUCIT Online Shop. 52 | 53 | More details can be found at: https://shop.lucit.services/software 54 | 55 | 56 | 5. CONTRIBUTING CODE 57 | 58 | Contributions via GitHub pull requests are welcome. However, contributors should be aware that submitted code 59 | automatically becomes LUCIT IT-Management GmbH's property and copyright. 60 | 61 | 62 | 6. USAGE AND DISTRIBUTION 63 | 64 | The LSOSL licensed projects of LUCIT IT-Management GmbH can be used and integrated into any application without 65 | restriction and distributed as desired. The only condition is that the execution of our software requires a valid 66 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 67 | 68 | For information on library versions that do not contain a license requirement, please contact: sales@lucit.tech 69 | 70 | 71 | 7. DATA COLLECTION AND LICENSE CONTROL 72 | 73 | For license adherence, test license misuse prevention, API rate monitoring, and service improvement, we gather: 74 | 75 | - User IP addresses 76 | - Instance log data 77 | - Used Python version 78 | - Operating system type 79 | - API usage rates 80 | - MAC addresses (for misuse detection) 81 | - Data volume processed (anonymously aggregated) 82 | 83 | This data is stored only for its intended purpose and duration, except for anonymous statistics. We commit to 84 | confidentiality and non-disclosure. Details are in our privacy policy. 85 | 86 | 87 | 8. THIRD-PARTY SOFTWARE 88 | 89 | The software may embed third-party code or libraries, each governed by their respective licenses. Ensure awareness and 90 | compliance when using the software. 91 | 92 | 93 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 94 | 95 | The software is rendered "as is", sans any assurances. LUCIT IT-Management GmbH disclaims liability for any potential 96 | repercussions arising from software usage. 97 | 98 | 99 | 10. CHANGES TO LICENSE TERMS 100 | 101 | LUCIT IT-Management GmbH reserves the right to modify, alter, or update the terms of this license at any time and at 102 | its sole discretion. Users are encouraged to review the license terms regularly to ensure compliance. 103 | 104 | ------------------------------------------------------------------------------------------------------------------------ 105 | 106 | Thank you for selecting the UNICORN Binance Local Depth Cache and products from LUCIT IT-Management GmbH. We deeply value 107 | your trust in our technologies. 108 | 109 | LUCIT IT-Management GmbH - Am Berg 391, 3970 Weitra, AUSTRIA - https://www.lucit.tech -------------------------------------------------------------------------------- /dev/sphinx/source/modules.rst: -------------------------------------------------------------------------------- 1 | unicorn_binance_local_depth_cache 2 | ================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | unicorn_binance_local_depth_cache 8 | -------------------------------------------------------------------------------- /dev/sphinx/source/security.md: -------------------------------------------------------------------------------- 1 | # Security Policies and Procedures 2 | This document outlines security procedures and general policies for the 3 | `unicorn-binance-local-depth-cache` project. 4 | 5 | * [Reporting a Bug](#reporting-a-bug) 6 | * [Disclosure Policy](#disclosure-policy) 7 | * [Comments on this Policy](#comments-on-this-policy) 8 | 9 | ## Reporting a Bug 10 | `LUCIT Systems and Development` takes all security bugs in `unicorn-binance-local-depth-cache` seriously. 11 | Thank you for improving the security of `unicorn-binance-local-depth-cache`. We appreciate your 12 | efforts and responsible disclosure and will make every effort to acknowledge your contributions. 13 | 14 | Report security bugs via our contact form: 15 | https://www.lucit.tech/contact-unicorn-developers.html 16 | 17 | The lead maintainer will acknowledge your email within 48 hours, and will send a 18 | more detailed response within 48 hours indicating the next steps in handling 19 | your report. After the initial reply to your report, the security team will 20 | endeavor to keep you informed of the progress towards a fix and full 21 | announcement, and may ask for additional information or guidance. 22 | 23 | Report security bugs in third-party modules to the person or team maintaining 24 | the module. 25 | 26 | ## Disclosure Policy 27 | When the security team receives a security bug report, they will assign it to a 28 | primary handler. This person will coordinate the fix and release process, 29 | involving the following steps: 30 | 31 | * Confirm the problem and determine the affected versions. 32 | * Audit code to find any potential similar problems. 33 | * Prepare fixes for all releases still under maintenance. These fixes will be 34 | released as fast as possible to pip. 35 | 36 | ## Comments on this Policy 37 | If you have suggestions on how this process could be improved please submit a 38 | pull request. 39 | -------------------------------------------------------------------------------- /dev/sphinx/source/unicorn_binance_local_depth_cache.rst: -------------------------------------------------------------------------------- 1 | unicorn\_binance\_local\_depth\_cache package 2 | ============================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_manager module 8 | ------------------------------------------------------------------------------------------- 9 | 10 | .. automodule:: unicorn_binance_local_depth_cache.manager 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_exceptions module 16 | ---------------------------------------------------------------------------------------------- 17 | 18 | .. automodule:: unicorn_binance_local_depth_cache.exceptions 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_cluster module 24 | ------------------------------------------------------------------------------------------- 25 | 26 | .. automodule:: unicorn_binance_local_depth_cache.cluster 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_cluster_endpoints module 32 | ----------------------------------------------------------------------------------------------------- 33 | 34 | .. automodule:: unicorn_binance_local_depth_cache.cluster_endpoints 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: unicorn_binance_local_depth_cache 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /dev/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | import time 5 | 6 | from dotenv import load_dotenv 7 | from unicorn_binance_local_depth_cache import (BinanceLocalDepthCacheManager, DepthCacheOutOfSync, 8 | DepthCacheAlreadyStopped) 9 | from unicorn_binance_rest_api import BinanceRestApiManager 10 | import asyncio 11 | import logging 12 | import os 13 | 14 | amount_test_caches: int = 40 15 | 16 | logging.getLogger("unicorn_binance_local_depth_cache") 17 | logging.basicConfig(level=logging.DEBUG, 18 | filename=os.path.basename(__file__) + '.log', 19 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 20 | style="{") 21 | load_dotenv() 22 | 23 | 24 | async def main(): 25 | with BinanceRestApiManager(exchange="binance.com-futures") as ubra: 26 | exchange_info = ubra.futures_exchange_info() 27 | markets = [] 28 | for item in exchange_info['symbols']: 29 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 30 | markets.append(item['symbol']) 31 | markets = markets[:amount_test_caches] 32 | ubldc.create_depthcache(markets=markets) 33 | while ubldc.is_stop_request() is False: 34 | working = [] 35 | non_working = [] 36 | for market in markets: 37 | try: 38 | ubldc.get_asks(market=market, limit_count=1) 39 | working.append(market) 40 | except DepthCacheOutOfSync: 41 | non_working.append(market) 42 | except DepthCacheAlreadyStopped: 43 | non_working.append(market) 44 | ubldc.print_summary(add_string=f"Working: {len(working)}, Non-Working: {len(non_working)}") 45 | await asyncio.sleep(60) 46 | 47 | 48 | with BinanceLocalDepthCacheManager(exchange="binance.com-futures") as ubldc: 49 | try: 50 | asyncio.run(main()) 51 | except KeyboardInterrupt: 52 | print("\r\nGracefully stopping ...") 53 | -------------------------------------------------------------------------------- /dev/test_cache.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | from unicorn_binance_rest_api import BinanceRestApiManager 7 | import asyncio 8 | import logging 9 | import os 10 | import time 11 | 12 | exchange = "binance.com-futures" 13 | update_interval_ms = None 14 | 15 | logging.getLogger("unicorn_binance_local_depth_cache") 16 | logging.basicConfig(level=logging.DEBUG, 17 | filename=os.path.basename(__file__) + '.log', 18 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 19 | style="{") 20 | 21 | show_offers = False 22 | 23 | 24 | async def main(): 25 | exclude_markets: list = ['BCCUSDT', 'VENUSDT', 'TRXUSDT', 'NULSUSDT', 'TUSDUSDT', 'PAXUSDT', 'BCHABCUSDT', 26 | 'BCHSVUSDT', 'BTTUSDT', 'USDSUSDT', 'USDCUSDT', 'TFUELUSDT', 'MITHUSDT', 'NANOUSDT', 27 | 'DASHUSDT', 'NEOUSDT', 'ICXUSDT'] 28 | all_markets: list = [item['symbol'] for item in ubra.get_all_tickers() if item['symbol'].endswith("USDT")] 29 | markets: list = [] 30 | 31 | for market in all_markets[:30]: 32 | if market not in exclude_markets: 33 | markets.append(market) 34 | 35 | print(f"Starting DepthCaches for markets: {markets}") 36 | ubldc.create_depth_cache(markets=markets) 37 | 38 | while ubldc.is_stop_request() is False: 39 | add_string = (f"binance_api_status={ubra.get_used_weight(cached=True)}\r\n " 40 | f"---------------------------------------------------------------------------------------------") 41 | for market in markets: 42 | try: 43 | top_asks = ubldc.get_asks(market=market, limit_count=4) 44 | top_bids = ubldc.get_bids(market=market, limit_count=4) 45 | except DepthCacheOutOfSync: 46 | top_asks = "Out of sync!" 47 | top_bids = "Out of sync!" 48 | if show_offers is True: 49 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 50 | f"top 4 asks: {top_asks}\r\n " 51 | f"top 4 bids: {top_bids}") 52 | else: 53 | depth = f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}" 54 | add_string = f"{add_string}\r\n {depth}" 55 | 56 | ubldc.print_summary(add_string=add_string) 57 | time.sleep(1) 58 | 59 | 60 | ubra = BinanceRestApiManager(exchange=exchange) 61 | with BinanceLocalDepthCacheManager(exchange=exchange, 62 | init_time_window=15, 63 | ubra_manager=ubra, 64 | websocket_ping_interval=10, 65 | websocket_ping_timeout=15, 66 | depth_cache_update_interval=update_interval_ms) as ubldc: 67 | try: 68 | asyncio.run(main()) 69 | except KeyboardInterrupt: 70 | print("\r\nGracefully stopping ...") 71 | except Exception as e: 72 | print(f"\r\nERROR: {e}") 73 | print("Gracefully stopping ...") 74 | -------------------------------------------------------------------------------- /dev/test_plain.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: test_plain.py 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 22 | from lucit_licensing_python.exceptions import NoValidatedLucitLicense 23 | import asyncio 24 | import logging 25 | import os 26 | import sys 27 | 28 | logging.getLogger("unicorn_binance_local_depth_cache") 29 | logging.basicConfig(level=logging.DEBUG, 30 | filename=os.path.basename(__file__) + '.log', 31 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 32 | style="{") 33 | 34 | 35 | async def worker(ubldc): 36 | market = 'BTCUSDT' 37 | ubldc.create_depth_cache(markets=market) 38 | while ubldc.is_stop_request() is False: 39 | await asyncio.sleep(1) 40 | 41 | try: 42 | with BinanceLocalDepthCacheManager(exchange="binance.com") as ubldc_manager: 43 | try: 44 | asyncio.run(worker(ubldc_manager)) 45 | except KeyboardInterrupt: 46 | print("\r\nGracefully stopping ...") 47 | except NoValidatedLucitLicense as error_msg: 48 | print(f"ERROR: {error_msg}") 49 | sys.exit(1) 50 | -------------------------------------------------------------------------------- /dev/test_streams.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_websocket_api import * 6 | from unicorn_binance_rest_api import * 7 | import asyncio 8 | import logging 9 | import os 10 | 11 | exchange = "binance.com-futures" 12 | 13 | logging.getLogger("unicorn_binance_websocket_api") 14 | logging.basicConfig(level=logging.DEBUG, 15 | filename=os.path.basename(__file__) + '.log', 16 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 17 | style="{") 18 | 19 | 20 | async def main(ubra: BinanceRestApiManager = None, ubwa: BinanceWebSocketApiManager = None): 21 | async def process_asyncio_queue(stream_id=None): 22 | print(f"Start processing the data from stream '{ubwa.get_stream_label(stream_id)}':") 23 | while ubwa.is_stop_request(stream_id) is False: 24 | data = await ubwa.get_stream_data_from_asyncio_queue(stream_id) 25 | print(data) 26 | ubwa.asyncio_queue_task_done(stream_id) 27 | 28 | markets = ['TRXUSDT'] 29 | 30 | stream_id = ubwa.create_stream(channels=['depth'], 31 | markets=markets, 32 | stream_label="Depth Diff", 33 | process_asyncio_queue=process_asyncio_queue) 34 | print(f"Subscribed to: {ubwa.get_stream_info(stream_id=stream_id)['markets']}") 35 | while not ubwa.is_manager_stopping(): 36 | #ubwa.print_summary() 37 | print(f"INFO: {ubwa.get_stream_info(stream_id=stream_id)['markets']}") 38 | await asyncio.sleep(1) 39 | 40 | 41 | ubra_manager = BinanceRestApiManager(exchange=exchange) 42 | with BinanceWebSocketApiManager(exchange=exchange) as ubwa_manager: 43 | try: 44 | asyncio.run(main(ubra=ubra_manager, ubwa=ubwa_manager)) 45 | except KeyboardInterrupt: 46 | print("\r\nGracefully stopping ...") 47 | except Exception as e: 48 | print(f"\r\nERROR: {e}\r\nGracefully stopping ...") 49 | ubra_manager.stop_manager() 50 | -------------------------------------------------------------------------------- /dev/ubldc-test-yt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | import asyncio 7 | import logging 8 | 9 | logging.basicConfig(level=logging.ERROR, filename='dc.log') 10 | 11 | 12 | async def main(): 13 | limit_count: int = 3 14 | ubra = ubldc.get_ubra_manager() 15 | exchange_info = ubra.get_exchange_info() 16 | markets = [] 17 | for item in exchange_info['symbols']: 18 | if item['status'] == "TRADING": 19 | markets.append(item['symbol']) 20 | ubldc.create_depthcache(markets=markets[:600]) 21 | while ubldc.is_stop_request() is False: 22 | add_string = f"---------------------------------------------------------------------------------------------" 23 | working = [] 24 | not_working = [] 25 | for market in markets[:600]: 26 | try: 27 | top_asks_limit = ubldc.get_asks(market=market, limit_count=limit_count) 28 | top_bids_limit = ubldc.get_bids(market=market, limit_count=limit_count) 29 | working.append(market) 30 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)} " 31 | f" top {limit_count} asks: {top_asks_limit} | top {limit_count} bids: {top_bids_limit}") 32 | add_string = f"{add_string}\r\n {depth}" 33 | except DepthCacheOutOfSync: 34 | not_working.append(market) 35 | add_string += f"\r\n Working: {len(working)} | Not Working: {len(not_working)}" 36 | ubldc.print_summary(add_string=add_string) 37 | await asyncio.sleep(60) 38 | 39 | with BinanceLocalDepthCacheManager(exchange="binance.com") as ubldc: 40 | try: 41 | asyncio.run(main()) 42 | except KeyboardInterrupt: 43 | print("\r\nGracefully stopping ...") 44 | 45 | -------------------------------------------------------------------------------- /dev/unlink_lib.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm dev/unicorn_binance_local_depth_cache -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 11f2b17ceec1947efec679d6dec62b6b 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/.nojekyll -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache.docs.lucit.tech 2 | -------------------------------------------------------------------------------- /docs/_sources/code_of_conduct.md.txt: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at https://www.lucit.tech/contact-unicorn-developers.html. 59 | All complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /docs/_sources/contributing.md.txt: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via 4 | [issue](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues/new/choose) 5 | with the owners of this repository before making a change. 6 | 7 | Please note we have a 8 | [code of conduct](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/CODE_OF_CONDUCT.md), 9 | please follow it in all your interactions with the project. 10 | 11 | ## Pull Request Process 12 | 13 | 1. Discuss with owners 14 | 2. Fork 15 | 3. Contribute 16 | 4. Fulfill and confirm requirements of the pull request 17 | 5. Trigger the pull request -------------------------------------------------------------------------------- /docs/_sources/copyright.rst.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | =========== 3 | 4 | Copyright (c) 2022-2023 LUCIT Systems and Development (https://www.lucit.tech) and Oliver Zehentleitner (https://about.me/oliver-zehentleitner) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. unicorn-binance-local-depth-cache documentation master file, created by 2 | sphinx-quickstart on Sat Nov 2 14:14:48 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to unicorn-binance-local-depth-cache's documentation! 7 | ============================================================= 8 | 9 | .. toctree:: 10 | :maxdepth: 3 11 | :caption: Contents: 12 | 13 | Readme 14 | Modules 15 | ChangeLog 16 | Code of Conduct 17 | Contributing 18 | License 19 | Security 20 | 21 | 22 | Indices and tables 23 | ================== 24 | * :ref:`genindex` 25 | * :ref:`modindex` 26 | * :ref:`search` 27 | -------------------------------------------------------------------------------- /docs/_sources/license.rst.txt: -------------------------------------------------------------------------------- 1 | LSOSL - LUCIT Synergetic Open Source License 2 | ============================================ 3 | 4 | Version 1.0, November 2023 5 | 6 | 1. INTRODUCTION 7 | 2. PROJECT INFORMATION 8 | 3. LICENSE CONDITIONS AND VERIFICATION 9 | 4. LICENSE PURCHASE 10 | 5. CONTRIBUTING CODE 11 | 6. USAGE AND DISTRIBUTION 12 | 7. DATA COLLECTION AND LICENSE CONTROL 13 | 8. THIRD-PARTY SOFTWARE 14 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 15 | 10. CHANGES TO LICENSE TERMS 16 | 17 | ------------------------------------------------------------------------------------------------------------------------ 18 | 19 | 1. INTRODUCTION 20 | 21 | The "LUCIT Synergetic Open Source License" oversees the utilization and distribution of the UNICORN Binance Local Depth 22 | Cache, a part of the UNICORN Binance Suite by LUCIT IT-Management GmbH. This API enables the effortless integration of 23 | Binance features into diverse applications. 24 | 25 | 26 | 2. PROJECT INFORMATION 27 | 28 | - Project name: UNICORN Binance Local Depth Cache 29 | - Project page: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 30 | - GitHub repository: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 31 | - PyPI repository: https://pypi.org/project/unicorn-binance-local-depth-cache 32 | - Get a license: https://shop.lucit.services/software 33 | 34 | 35 | 3. LICENSE CONDITIONS AND VERIFICATION 36 | 37 | The use of UNICORN Binance Local Depth Cache requires a license key and an API secret. 38 | 39 | Licenses are available at: https://shop.lucit.services/software 40 | 41 | Verification is done via a client-side module that forwards the license details to our backend for validation. 42 | The software may be used and distributed without restriction, the only condition is that the execution requires a valid 43 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 44 | 45 | For transparency, our licensing client module is available on GitHub: 46 | https://github.com/LUCIT-Systems-and-Development/lucit-licensing-python 47 | 48 | 49 | 4. LICENSE PURCHASE 50 | 51 | Usage of the our software necessitates obtaining a license from the LUCIT Online Shop. 52 | 53 | More details can be found at: https://shop.lucit.services/software 54 | 55 | 56 | 5. CONTRIBUTING CODE 57 | 58 | Contributions via GitHub pull requests are welcome. However, contributors should be aware that submitted code 59 | automatically becomes LUCIT IT-Management GmbH's property and copyright. 60 | 61 | 62 | 6. USAGE AND DISTRIBUTION 63 | 64 | The LSOSL licensed projects of LUCIT IT-Management GmbH can be used and integrated into any application without 65 | restriction and distributed as desired. The only condition is that the execution of our software requires a valid 66 | license from LUCIT (https://shop.lucit.services/software) and must be operated with such a license. 67 | 68 | For information on library versions that do not contain a license requirement, please contact: sales@lucit.tech 69 | 70 | 71 | 7. DATA COLLECTION AND LICENSE CONTROL 72 | 73 | For license adherence, test license misuse prevention, API rate monitoring, and service improvement, we gather: 74 | 75 | - User IP addresses 76 | - Instance log data 77 | - Used Python version 78 | - Operating system type 79 | - API usage rates 80 | - MAC addresses (for misuse detection) 81 | - Data volume processed (anonymously aggregated) 82 | 83 | This data is stored only for its intended purpose and duration, except for anonymous statistics. We commit to 84 | confidentiality and non-disclosure. Details are in our privacy policy. 85 | 86 | 87 | 8. THIRD-PARTY SOFTWARE 88 | 89 | The software may embed third-party code or libraries, each governed by their respective licenses. Ensure awareness and 90 | compliance when using the software. 91 | 92 | 93 | 9. DISCLAIMER OF WARRANTY AND LIABILITY 94 | 95 | The software is rendered "as is", sans any assurances. LUCIT IT-Management GmbH disclaims liability for any potential 96 | repercussions arising from software usage. 97 | 98 | 99 | 10. CHANGES TO LICENSE TERMS 100 | 101 | LUCIT IT-Management GmbH reserves the right to modify, alter, or update the terms of this license at any time and at 102 | its sole discretion. Users are encouraged to review the license terms regularly to ensure compliance. 103 | 104 | ------------------------------------------------------------------------------------------------------------------------ 105 | 106 | Thank you for selecting the UNICORN Binance Local Depth Cache and products from LUCIT IT-Management GmbH. We deeply value 107 | your trust in our technologies. 108 | 109 | LUCIT IT-Management GmbH - Am Berg 391, 3970 Weitra, AUSTRIA - https://www.lucit.tech -------------------------------------------------------------------------------- /docs/_sources/modules.rst.txt: -------------------------------------------------------------------------------- 1 | unicorn_binance_local_depth_cache 2 | ================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | unicorn_binance_local_depth_cache 8 | -------------------------------------------------------------------------------- /docs/_sources/security.md.txt: -------------------------------------------------------------------------------- 1 | # Security Policies and Procedures 2 | This document outlines security procedures and general policies for the 3 | `unicorn-binance-local-depth-cache` project. 4 | 5 | * [Reporting a Bug](#reporting-a-bug) 6 | * [Disclosure Policy](#disclosure-policy) 7 | * [Comments on this Policy](#comments-on-this-policy) 8 | 9 | ## Reporting a Bug 10 | `LUCIT Systems and Development` takes all security bugs in `unicorn-binance-local-depth-cache` seriously. 11 | Thank you for improving the security of `unicorn-binance-local-depth-cache`. We appreciate your 12 | efforts and responsible disclosure and will make every effort to acknowledge your contributions. 13 | 14 | Report security bugs via our contact form: 15 | https://www.lucit.tech/contact-unicorn-developers.html 16 | 17 | The lead maintainer will acknowledge your email within 48 hours, and will send a 18 | more detailed response within 48 hours indicating the next steps in handling 19 | your report. After the initial reply to your report, the security team will 20 | endeavor to keep you informed of the progress towards a fix and full 21 | announcement, and may ask for additional information or guidance. 22 | 23 | Report security bugs in third-party modules to the person or team maintaining 24 | the module. 25 | 26 | ## Disclosure Policy 27 | When the security team receives a security bug report, they will assign it to a 28 | primary handler. This person will coordinate the fix and release process, 29 | involving the following steps: 30 | 31 | * Confirm the problem and determine the affected versions. 32 | * Audit code to find any potential similar problems. 33 | * Prepare fixes for all releases still under maintenance. These fixes will be 34 | released as fast as possible to pip. 35 | 36 | ## Comments on this Policy 37 | If you have suggestions on how this process could be improved please submit a 38 | pull request. 39 | -------------------------------------------------------------------------------- /docs/_sources/unicorn_binance_local_depth_cache.rst.txt: -------------------------------------------------------------------------------- 1 | unicorn\_binance\_local\_depth\_cache package 2 | ============================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_manager module 8 | ------------------------------------------------------------------------------------------- 9 | 10 | .. automodule:: unicorn_binance_local_depth_cache.manager 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_exceptions module 16 | ---------------------------------------------------------------------------------------------- 17 | 18 | .. automodule:: unicorn_binance_local_depth_cache.exceptions 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_cluster module 24 | ------------------------------------------------------------------------------------------- 25 | 26 | .. automodule:: unicorn_binance_local_depth_cache.cluster 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | unicorn\_binance\_local\_depth\_cache.unicorn\_binance\_local\_depth\_cache\_cluster_endpoints module 32 | ----------------------------------------------------------------------------------------------------- 33 | 34 | .. automodule:: unicorn_binance_local_depth_cache.cluster_endpoints 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: unicorn_binance_local_depth_cache 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /docs/_static/caret-down.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_static/classic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * classic.css_t 3 | * ~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- classic theme. 6 | * 7 | * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | html { 17 | /* CSS hack for macOS's scrollbar (see #1125) */ 18 | background-color: #FFFFFF; 19 | } 20 | 21 | body { 22 | font-family: 'Lucida Grande', Arial, sans-serif; 23 | font-size: 100%; 24 | background-color: white; 25 | color: #000; 26 | margin: 0; 27 | padding: 0; 28 | } 29 | 30 | div.document { 31 | display: flex; 32 | background-color: white; 33 | } 34 | 35 | div.documentwrapper { 36 | float: left; 37 | width: 100%; 38 | } 39 | 40 | div.bodywrapper { 41 | margin: 0 0 0 230px; 42 | } 43 | 44 | div.body { 45 | background-color: white; 46 | color: #222222; 47 | padding: 0 20px 30px 20px; 48 | } 49 | 50 | div.footer { 51 | color: #555555; 52 | width: 100%; 53 | padding: 9px 0 9px 0; 54 | text-align: center; 55 | font-size: 75%; 56 | } 57 | 58 | div.footer a { 59 | color: #555555; 60 | text-decoration: underline; 61 | } 62 | 63 | div.related { 64 | background-color: white; 65 | line-height: 30px; 66 | color: #666666; 67 | } 68 | 69 | div.related a { 70 | color: #444444; 71 | } 72 | 73 | div.sphinxsidebar { 74 | } 75 | 76 | div.sphinxsidebar h3 { 77 | font-family: 'Lucida Grande', Arial, sans-serif; 78 | color: #444444; 79 | font-size: 1.4em; 80 | font-weight: normal; 81 | margin: 0; 82 | padding: 0; 83 | } 84 | 85 | div.sphinxsidebar h3 a { 86 | color: #444444; 87 | } 88 | 89 | div.sphinxsidebar h4 { 90 | font-family: 'Lucida Grande', Arial, sans-serif; 91 | color: #444444; 92 | font-size: 1.3em; 93 | font-weight: normal; 94 | margin: 5px 0 0 0; 95 | padding: 0; 96 | } 97 | 98 | div.sphinxsidebar p { 99 | color: #444444; 100 | } 101 | 102 | div.sphinxsidebar p.topless { 103 | margin: 5px 10px 10px 10px; 104 | } 105 | 106 | div.sphinxsidebar ul { 107 | margin: 10px; 108 | padding: 0; 109 | color: #444444; 110 | } 111 | 112 | div.sphinxsidebar a { 113 | color: #444444; 114 | } 115 | 116 | div.sphinxsidebar input { 117 | border: 1px solid #444444; 118 | font-family: sans-serif; 119 | font-size: 1em; 120 | } 121 | 122 | 123 | 124 | /* -- hyperlink styles ------------------------------------------------------ */ 125 | 126 | a { 127 | color: #0090c0; 128 | text-decoration: none; 129 | } 130 | 131 | a:visited { 132 | color: #00608f; 133 | text-decoration: none; 134 | } 135 | 136 | a:hover { 137 | text-decoration: underline; 138 | } 139 | 140 | 141 | 142 | /* -- body styles ----------------------------------------------------------- */ 143 | 144 | div.body h1, 145 | div.body h2, 146 | div.body h3, 147 | div.body h4, 148 | div.body h5, 149 | div.body h6 { 150 | font-family: 'Lucida Grande', Arial, sans-serif; 151 | background-color: white; 152 | font-weight: normal; 153 | color: #1a1a1a; 154 | border-bottom: 1px solid #ccc; 155 | margin: 20px -20px 10px -20px; 156 | padding: 3px 0 3px 10px; 157 | } 158 | 159 | div.body h1 { margin-top: 0; font-size: 200%; } 160 | div.body h2 { font-size: 160%; } 161 | div.body h3 { font-size: 140%; } 162 | div.body h4 { font-size: 120%; } 163 | div.body h5 { font-size: 110%; } 164 | div.body h6 { font-size: 100%; } 165 | 166 | a.headerlink { 167 | color: #aaaaaa; 168 | font-size: 0.8em; 169 | padding: 0 4px 0 4px; 170 | text-decoration: none; 171 | } 172 | 173 | a.headerlink:hover { 174 | background-color: #aaaaaa; 175 | color: white; 176 | } 177 | 178 | div.body p, div.body dd, div.body li, div.body blockquote { 179 | text-align: justify; 180 | line-height: 130%; 181 | } 182 | 183 | div.admonition p.admonition-title + p { 184 | display: inline; 185 | } 186 | 187 | div.admonition p { 188 | margin-bottom: 5px; 189 | } 190 | 191 | div.admonition pre { 192 | margin-bottom: 5px; 193 | } 194 | 195 | div.admonition ul, div.admonition ol { 196 | margin-bottom: 5px; 197 | } 198 | 199 | div.note { 200 | background-color: #eee; 201 | border: 1px solid #ccc; 202 | } 203 | 204 | div.seealso { 205 | background-color: #ffc; 206 | border: 1px solid #ff6; 207 | } 208 | 209 | nav.contents, 210 | aside.topic, 211 | div.topic { 212 | background-color: #eee; 213 | } 214 | 215 | div.warning { 216 | background-color: #ffe4e4; 217 | border: 1px solid #f66; 218 | } 219 | 220 | p.admonition-title { 221 | display: inline; 222 | } 223 | 224 | p.admonition-title:after { 225 | content: ":"; 226 | } 227 | 228 | pre { 229 | padding: 5px; 230 | background-color: #eeffcc; 231 | color: #333333; 232 | line-height: 120%; 233 | border: 1px solid #ac9; 234 | border-left: none; 235 | border-right: none; 236 | } 237 | 238 | code { 239 | background-color: #ecf0f3; 240 | padding: 0 1px 0 1px; 241 | font-size: 0.95em; 242 | } 243 | 244 | th, dl.field-list > dt { 245 | background-color: #ede; 246 | } 247 | 248 | .warning code { 249 | background: #efc2c2; 250 | } 251 | 252 | .note code { 253 | background: #d6d6d6; 254 | } 255 | 256 | .viewcode-back { 257 | font-family: 'Lucida Grande', Arial, sans-serif; 258 | } 259 | 260 | div.viewcode-block:target { 261 | background-color: #f4debf; 262 | border-top: 1px solid #ac9; 263 | border-bottom: 1px solid #ac9; 264 | } 265 | 266 | div.code-block-caption { 267 | color: #efefef; 268 | background-color: #1c4e63; 269 | } -------------------------------------------------------------------------------- /docs/_static/copybutton.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | /* Add a [>>>] button on the top-right corner of code samples to hide 3 | * the >>> and ... prompts and the output and thus make the code 4 | * copyable. */ 5 | var div = $('.highlight-python .highlight,' + 6 | '.highlight-python3 .highlight,' + 7 | '.highlight-pycon .highlight,' + 8 | '.highlight-pycon3 .highlight,' + 9 | '.highlight-default .highlight'); 10 | var pre = div.find('pre'); 11 | 12 | // get the styles from the current theme 13 | pre.parent().parent().css('position', 'relative'); 14 | var hide_text = 'Hide the prompts and output'; 15 | var show_text = 'Show the prompts and output'; 16 | var border_width = pre.css('border-top-width'); 17 | var border_style = pre.css('border-top-style'); 18 | var border_color = pre.css('border-top-color'); 19 | var button_styles = { 20 | 'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0', 21 | 'border-color': border_color, 'border-style': border_style, 22 | 'border-width': border_width, 'color': border_color, 'text-size': '75%', 23 | 'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em', 24 | 'border-radius': '0 3px 0 0' 25 | } 26 | 27 | // create and add the button to all the code blocks that contain >>> 28 | div.each(function(index) { 29 | var jthis = $(this); 30 | if (jthis.find('.gp').length > 0) { 31 | var button = $('>>>'); 32 | button.css(button_styles) 33 | button.attr('title', hide_text); 34 | button.data('hidden', 'false'); 35 | jthis.prepend(button); 36 | } 37 | // tracebacks (.gt) contain bare text elements that need to be 38 | // wrapped in a span to work with .nextUntil() (see later) 39 | jthis.find('pre:has(.gt)').contents().filter(function() { 40 | return ((this.nodeType == 3) && (this.data.trim().length > 0)); 41 | }).wrap(''); 42 | }); 43 | 44 | // define the behavior of the button when it's clicked 45 | $('.copybutton').click(function(e){ 46 | e.preventDefault(); 47 | var button = $(this); 48 | if (button.data('hidden') === 'false') { 49 | // hide the code output 50 | button.parent().find('.go, .gp, .gt').hide(); 51 | button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden'); 52 | button.css('text-decoration', 'line-through'); 53 | button.attr('title', show_text); 54 | button.data('hidden', 'true'); 55 | } else { 56 | // show the code output 57 | button.parent().find('.go, .gp, .gt').show(); 58 | button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible'); 59 | button.css('text-decoration', 'none'); 60 | button.attr('title', hide_text); 61 | button.data('hidden', 'false'); 62 | } 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /docs/_static/default.css: -------------------------------------------------------------------------------- 1 | @import url("classic.css"); 2 | -------------------------------------------------------------------------------- /docs/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Base JavaScript utilities for all Sphinx HTML documentation. 6 | * 7 | * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | "use strict"; 12 | 13 | const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ 14 | "TEXTAREA", 15 | "INPUT", 16 | "SELECT", 17 | "BUTTON", 18 | ]); 19 | 20 | const _ready = (callback) => { 21 | if (document.readyState !== "loading") { 22 | callback(); 23 | } else { 24 | document.addEventListener("DOMContentLoaded", callback); 25 | } 26 | }; 27 | 28 | /** 29 | * Small JavaScript module for the documentation. 30 | */ 31 | const Documentation = { 32 | init: () => { 33 | Documentation.initDomainIndexTable(); 34 | Documentation.initOnKeyListeners(); 35 | }, 36 | 37 | /** 38 | * i18n support 39 | */ 40 | TRANSLATIONS: {}, 41 | PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), 42 | LOCALE: "unknown", 43 | 44 | // gettext and ngettext don't access this so that the functions 45 | // can safely bound to a different name (_ = Documentation.gettext) 46 | gettext: (string) => { 47 | const translated = Documentation.TRANSLATIONS[string]; 48 | switch (typeof translated) { 49 | case "undefined": 50 | return string; // no translation 51 | case "string": 52 | return translated; // translation exists 53 | default: 54 | return translated[0]; // (singular, plural) translation tuple exists 55 | } 56 | }, 57 | 58 | ngettext: (singular, plural, n) => { 59 | const translated = Documentation.TRANSLATIONS[singular]; 60 | if (typeof translated !== "undefined") 61 | return translated[Documentation.PLURAL_EXPR(n)]; 62 | return n === 1 ? singular : plural; 63 | }, 64 | 65 | addTranslations: (catalog) => { 66 | Object.assign(Documentation.TRANSLATIONS, catalog.messages); 67 | Documentation.PLURAL_EXPR = new Function( 68 | "n", 69 | `return (${catalog.plural_expr})` 70 | ); 71 | Documentation.LOCALE = catalog.locale; 72 | }, 73 | 74 | /** 75 | * helper function to focus on search bar 76 | */ 77 | focusSearchBar: () => { 78 | document.querySelectorAll("input[name=q]")[0]?.focus(); 79 | }, 80 | 81 | /** 82 | * Initialise the domain index toggle buttons 83 | */ 84 | initDomainIndexTable: () => { 85 | const toggler = (el) => { 86 | const idNumber = el.id.substr(7); 87 | const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); 88 | if (el.src.substr(-9) === "minus.png") { 89 | el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; 90 | toggledRows.forEach((el) => (el.style.display = "none")); 91 | } else { 92 | el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; 93 | toggledRows.forEach((el) => (el.style.display = "")); 94 | } 95 | }; 96 | 97 | const togglerElements = document.querySelectorAll("img.toggler"); 98 | togglerElements.forEach((el) => 99 | el.addEventListener("click", (event) => toggler(event.currentTarget)) 100 | ); 101 | togglerElements.forEach((el) => (el.style.display = "")); 102 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); 103 | }, 104 | 105 | initOnKeyListeners: () => { 106 | // only install a listener if it is really needed 107 | if ( 108 | !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && 109 | !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS 110 | ) 111 | return; 112 | 113 | document.addEventListener("keydown", (event) => { 114 | // bail for input elements 115 | if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; 116 | // bail with special keys 117 | if (event.altKey || event.ctrlKey || event.metaKey) return; 118 | 119 | if (!event.shiftKey) { 120 | switch (event.key) { 121 | case "ArrowLeft": 122 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 123 | 124 | const prevLink = document.querySelector('link[rel="prev"]'); 125 | if (prevLink && prevLink.href) { 126 | window.location.href = prevLink.href; 127 | event.preventDefault(); 128 | } 129 | break; 130 | case "ArrowRight": 131 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 132 | 133 | const nextLink = document.querySelector('link[rel="next"]'); 134 | if (nextLink && nextLink.href) { 135 | window.location.href = nextLink.href; 136 | event.preventDefault(); 137 | } 138 | break; 139 | } 140 | } 141 | 142 | // some keyboard layouts may need Shift to get / 143 | switch (event.key) { 144 | case "/": 145 | if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; 146 | Documentation.focusSearchBar(); 147 | event.preventDefault(); 148 | } 149 | }); 150 | }, 151 | }; 152 | 153 | // quick alias for translations 154 | const _ = Documentation.gettext; 155 | 156 | _ready(Documentation.init); 157 | -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '1.2.0', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/github-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/github-logo.png -------------------------------------------------------------------------------- /docs/_static/icons8-facebook-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-facebook-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-github-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-github-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-linkedin-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-linkedin-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-medium-monogram-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-medium-monogram-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-twitter-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-twitter-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-xing-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-xing-20.png -------------------------------------------------------------------------------- /docs/_static/icons8-youtube-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/icons8-youtube-20.png -------------------------------------------------------------------------------- /docs/_static/language_data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * language_data.js 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * This script contains the language-specific data used by searchtools.js, 6 | * namely the list of stopwords, stemmer, scorer and splitter. 7 | * 8 | * :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. 9 | * :license: BSD, see LICENSE for details. 10 | * 11 | */ 12 | 13 | var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; 14 | 15 | 16 | /* Non-minified version is copied as a separate JS file, is available */ 17 | 18 | /** 19 | * Porter Stemmer 20 | */ 21 | var Stemmer = function() { 22 | 23 | var step2list = { 24 | ational: 'ate', 25 | tional: 'tion', 26 | enci: 'ence', 27 | anci: 'ance', 28 | izer: 'ize', 29 | bli: 'ble', 30 | alli: 'al', 31 | entli: 'ent', 32 | eli: 'e', 33 | ousli: 'ous', 34 | ization: 'ize', 35 | ation: 'ate', 36 | ator: 'ate', 37 | alism: 'al', 38 | iveness: 'ive', 39 | fulness: 'ful', 40 | ousness: 'ous', 41 | aliti: 'al', 42 | iviti: 'ive', 43 | biliti: 'ble', 44 | logi: 'log' 45 | }; 46 | 47 | var step3list = { 48 | icate: 'ic', 49 | ative: '', 50 | alize: 'al', 51 | iciti: 'ic', 52 | ical: 'ic', 53 | ful: '', 54 | ness: '' 55 | }; 56 | 57 | var c = "[^aeiou]"; // consonant 58 | var v = "[aeiouy]"; // vowel 59 | var C = c + "[^aeiouy]*"; // consonant sequence 60 | var V = v + "[aeiou]*"; // vowel sequence 61 | 62 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 63 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 64 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 65 | var s_v = "^(" + C + ")?" + v; // vowel in stem 66 | 67 | this.stemWord = function (w) { 68 | var stem; 69 | var suffix; 70 | var firstch; 71 | var origword = w; 72 | 73 | if (w.length < 3) 74 | return w; 75 | 76 | var re; 77 | var re2; 78 | var re3; 79 | var re4; 80 | 81 | firstch = w.substr(0,1); 82 | if (firstch == "y") 83 | w = firstch.toUpperCase() + w.substr(1); 84 | 85 | // Step 1a 86 | re = /^(.+?)(ss|i)es$/; 87 | re2 = /^(.+?)([^s])s$/; 88 | 89 | if (re.test(w)) 90 | w = w.replace(re,"$1$2"); 91 | else if (re2.test(w)) 92 | w = w.replace(re2,"$1$2"); 93 | 94 | // Step 1b 95 | re = /^(.+?)eed$/; 96 | re2 = /^(.+?)(ed|ing)$/; 97 | if (re.test(w)) { 98 | var fp = re.exec(w); 99 | re = new RegExp(mgr0); 100 | if (re.test(fp[1])) { 101 | re = /.$/; 102 | w = w.replace(re,""); 103 | } 104 | } 105 | else if (re2.test(w)) { 106 | var fp = re2.exec(w); 107 | stem = fp[1]; 108 | re2 = new RegExp(s_v); 109 | if (re2.test(stem)) { 110 | w = stem; 111 | re2 = /(at|bl|iz)$/; 112 | re3 = new RegExp("([^aeiouylsz])\\1$"); 113 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 114 | if (re2.test(w)) 115 | w = w + "e"; 116 | else if (re3.test(w)) { 117 | re = /.$/; 118 | w = w.replace(re,""); 119 | } 120 | else if (re4.test(w)) 121 | w = w + "e"; 122 | } 123 | } 124 | 125 | // Step 1c 126 | re = /^(.+?)y$/; 127 | if (re.test(w)) { 128 | var fp = re.exec(w); 129 | stem = fp[1]; 130 | re = new RegExp(s_v); 131 | if (re.test(stem)) 132 | w = stem + "i"; 133 | } 134 | 135 | // Step 2 136 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 137 | if (re.test(w)) { 138 | var fp = re.exec(w); 139 | stem = fp[1]; 140 | suffix = fp[2]; 141 | re = new RegExp(mgr0); 142 | if (re.test(stem)) 143 | w = stem + step2list[suffix]; 144 | } 145 | 146 | // Step 3 147 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 148 | if (re.test(w)) { 149 | var fp = re.exec(w); 150 | stem = fp[1]; 151 | suffix = fp[2]; 152 | re = new RegExp(mgr0); 153 | if (re.test(stem)) 154 | w = stem + step3list[suffix]; 155 | } 156 | 157 | // Step 4 158 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 159 | re2 = /^(.+?)(s|t)(ion)$/; 160 | if (re.test(w)) { 161 | var fp = re.exec(w); 162 | stem = fp[1]; 163 | re = new RegExp(mgr1); 164 | if (re.test(stem)) 165 | w = stem; 166 | } 167 | else if (re2.test(w)) { 168 | var fp = re2.exec(w); 169 | stem = fp[1] + fp[2]; 170 | re2 = new RegExp(mgr1); 171 | if (re2.test(stem)) 172 | w = stem; 173 | } 174 | 175 | // Step 5 176 | re = /^(.+?)e$/; 177 | if (re.test(w)) { 178 | var fp = re.exec(w); 179 | stem = fp[1]; 180 | re = new RegExp(mgr1); 181 | re2 = new RegExp(meq1); 182 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 183 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 184 | w = stem; 185 | } 186 | re = /ll$/; 187 | re2 = new RegExp(mgr1); 188 | if (re.test(w) && re2.test(w)) { 189 | re = /.$/; 190 | w = w.replace(re,""); 191 | } 192 | 193 | // and turn initial Y back to y 194 | if (firstch == "y") 195 | w = firstch.toLowerCase() + w.substr(1); 196 | return w; 197 | } 198 | } 199 | 200 | -------------------------------------------------------------------------------- /docs/_static/lucit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/lucit.png -------------------------------------------------------------------------------- /docs/_static/menu.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function () { 2 | 3 | // Make tables responsive by wrapping them in a div and making them scrollable 4 | const tables = document.querySelectorAll('table.docutils'); 5 | tables.forEach(function(table){ 6 | table.outerHTML = '
' + table.outerHTML + '
' 7 | }); 8 | 9 | const togglerInput = document.querySelector('.toggler__input'); 10 | const togglerLabel = document.querySelector('.toggler__label'); 11 | const sideMenu = document.querySelector('.menu-wrapper'); 12 | const menuItems = document.querySelectorAll('.menu') 13 | const doc = document.querySelector('.document'); 14 | const body = document.querySelector('body'); 15 | 16 | function closeMenu() { 17 | togglerInput.checked = false; 18 | sideMenu.setAttribute("aria-expanded", 'false'); 19 | sideMenu.setAttribute('aria-hidden', 'true'); 20 | togglerLabel.setAttribute('aria-pressed', 'false'); 21 | body.style.overflow = 'visible'; 22 | } 23 | function openMenu() { 24 | togglerInput.checked = true; 25 | sideMenu.setAttribute("aria-expanded", 'true'); 26 | sideMenu.setAttribute('aria-hidden', 'false'); 27 | togglerLabel.setAttribute('aria-pressed', 'true'); 28 | body.style.overflow = 'hidden'; 29 | } 30 | 31 | // Close menu when link on the sideMenu is clicked 32 | sideMenu.addEventListener('click', function (event) { 33 | let target = event.target; 34 | if (target.tagName.toLowerCase() !== 'a') return; 35 | closeMenu(); 36 | }) 37 | // Add accessibility data when sideMenu is opened/closed 38 | togglerInput.addEventListener('change', function (e) { 39 | togglerInput.checked ? openMenu() : closeMenu(); 40 | }); 41 | // Make sideMenu links tabbable only when visible 42 | for(let menuItem of menuItems) { 43 | if(togglerInput.checked) { 44 | menuItem.setAttribute('tabindex', '0'); 45 | } else { 46 | menuItem.setAttribute('tabindex', '-1'); 47 | } 48 | } 49 | // Close sideMenu when document body is clicked 50 | doc.addEventListener('click', function () { 51 | if (togglerInput.checked) { 52 | closeMenu(); 53 | } 54 | }) 55 | }) -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/plus.png -------------------------------------------------------------------------------- /docs/_static/py.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/docs/_static/py.png -------------------------------------------------------------------------------- /docs/_static/py.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/_static/pygments.css: -------------------------------------------------------------------------------- 1 | pre { line-height: 125%; } 2 | td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 3 | span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 4 | td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 5 | span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 6 | .highlight .hll { background-color: #ffffcc } 7 | .highlight { background: #f8f8f8; } 8 | .highlight .c { color: #3D7B7B; font-style: italic } /* Comment */ 9 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 10 | .highlight .k { color: #008000; font-weight: bold } /* Keyword */ 11 | .highlight .o { color: #666666 } /* Operator */ 12 | .highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #9C6500 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ 18 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 19 | .highlight .ge { font-style: italic } /* Generic.Emph */ 20 | .highlight .gr { color: #E40000 } /* Generic.Error */ 21 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 22 | .highlight .gi { color: #008400 } /* Generic.Inserted */ 23 | .highlight .go { color: #717171 } /* Generic.Output */ 24 | .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 25 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 26 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 27 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 28 | .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ 29 | .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ 30 | .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ 31 | .highlight .kp { color: #008000 } /* Keyword.Pseudo */ 32 | .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ 33 | .highlight .kt { color: #B00040 } /* Keyword.Type */ 34 | .highlight .m { color: #666666 } /* Literal.Number */ 35 | .highlight .s { color: #BA2121 } /* Literal.String */ 36 | .highlight .na { color: #687822 } /* Name.Attribute */ 37 | .highlight .nb { color: #008000 } /* Name.Builtin */ 38 | .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ 39 | .highlight .no { color: #880000 } /* Name.Constant */ 40 | .highlight .nd { color: #AA22FF } /* Name.Decorator */ 41 | .highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */ 42 | .highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */ 43 | .highlight .nf { color: #0000FF } /* Name.Function */ 44 | .highlight .nl { color: #767600 } /* Name.Label */ 45 | .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ 46 | .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ 47 | .highlight .nv { color: #19177C } /* Name.Variable */ 48 | .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ 49 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 50 | .highlight .mb { color: #666666 } /* Literal.Number.Bin */ 51 | .highlight .mf { color: #666666 } /* Literal.Number.Float */ 52 | .highlight .mh { color: #666666 } /* Literal.Number.Hex */ 53 | .highlight .mi { color: #666666 } /* Literal.Number.Integer */ 54 | .highlight .mo { color: #666666 } /* Literal.Number.Oct */ 55 | .highlight .sa { color: #BA2121 } /* Literal.String.Affix */ 56 | .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ 57 | .highlight .sc { color: #BA2121 } /* Literal.String.Char */ 58 | .highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */ 59 | .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ 60 | .highlight .s2 { color: #BA2121 } /* Literal.String.Double */ 61 | .highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */ 62 | .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ 63 | .highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */ 64 | .highlight .sx { color: #008000 } /* Literal.String.Other */ 65 | .highlight .sr { color: #A45A77 } /* Literal.String.Regex */ 66 | .highlight .s1 { color: #BA2121 } /* Literal.String.Single */ 67 | .highlight .ss { color: #19177C } /* Literal.String.Symbol */ 68 | .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ 69 | .highlight .fm { color: #0000FF } /* Name.Function.Magic */ 70 | .highlight .vc { color: #19177C } /* Name.Variable.Class */ 71 | .highlight .vg { color: #19177C } /* Name.Variable.Global */ 72 | .highlight .vi { color: #19177C } /* Name.Variable.Instance */ 73 | .highlight .vm { color: #19177C } /* Name.Variable.Magic */ 74 | .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/_static/searchbox.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/searchbox.html 3 | ~~~~~~~~~~~~~~~~~~~~ 4 | 5 | Sphinx sidebar template: quick search box. 6 | 7 | :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- if builder != "singlehtml" %} 11 |
12 |

GitHub

13 |
    14 |
  • Show Source
  • 15 | {% include "github.html" %} 16 |
17 |
18 | 19 | {%- endif %} 20 | {%- if pagename != "search" and builder != "singlehtml" %} 21 | 30 | 31 |
32 | {%- endif %} 33 | -------------------------------------------------------------------------------- /docs/_static/sidebar.js: -------------------------------------------------------------------------------- 1 | /* 2 | * sidebar.js 3 | * ~~~~~~~~~~ 4 | * 5 | * This script makes the Sphinx sidebar collapsible. This is a slightly 6 | * modified version of Sphinx's own sidebar.js. 7 | * 8 | * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds in 9 | * .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton used to 10 | * collapse and expand the sidebar. 11 | * 12 | * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden and the 13 | * width of the sidebar and the margin-left of the document are decreased. 14 | * When the sidebar is expanded the opposite happens. This script saves a 15 | * per-browser/per-session cookie used to remember the position of the sidebar 16 | * among the pages. Once the browser is closed the cookie is deleted and the 17 | * position reset to the default (expanded). 18 | * 19 | * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 20 | * :license: BSD, see LICENSE for details. 21 | * 22 | */ 23 | 24 | $(function() { 25 | // global elements used by the functions. 26 | // the 'sidebarbutton' element is defined as global after its 27 | // creation, in the add_sidebar_button function 28 | var bodywrapper = $('.bodywrapper'); 29 | var sidebar = $('.sphinxsidebar'); 30 | var sidebarwrapper = $('.sphinxsidebarwrapper'); 31 | 32 | // original margin-left of the bodywrapper and width of the sidebar 33 | // with the sidebar expanded 34 | var bw_margin_expanded = bodywrapper.css('margin-left'); 35 | var ssb_width_expanded = sidebar.width(); 36 | 37 | // margin-left of the bodywrapper and width of the sidebar 38 | // with the sidebar collapsed 39 | var bw_margin_collapsed = '.8em'; 40 | var ssb_width_collapsed = '.8em'; 41 | 42 | // colors used by the current theme 43 | var dark_color = '#AAAAAA'; 44 | var light_color = '#CCCCCC'; 45 | 46 | function sidebar_is_collapsed() { 47 | return sidebarwrapper.is(':not(:visible)'); 48 | } 49 | 50 | function toggle_sidebar() { 51 | if (sidebar_is_collapsed()) 52 | expand_sidebar(); 53 | else 54 | collapse_sidebar(); 55 | } 56 | 57 | function collapse_sidebar() { 58 | sidebarwrapper.hide(); 59 | sidebar.css('width', ssb_width_collapsed); 60 | bodywrapper.css('margin-left', bw_margin_collapsed); 61 | sidebarbutton.css({ 62 | 'margin-left': '0', 63 | 'border-radius': '5px' 64 | }); 65 | sidebarbutton.find('span').text('»'); 66 | sidebarbutton.attr('title', _('Expand sidebar')); 67 | document.cookie = 'sidebar=collapsed'; 68 | } 69 | 70 | function expand_sidebar() { 71 | bodywrapper.css('margin-left', bw_margin_expanded); 72 | sidebar.css('width', ssb_width_expanded); 73 | sidebarwrapper.show(); 74 | sidebarbutton.css({ 75 | 'margin-left': ssb_width_expanded-12, 76 | 'border-radius': '0 5px 5px 0' 77 | }); 78 | sidebarbutton.find('span').text('«'); 79 | sidebarbutton.attr('title', _('Collapse sidebar')); 80 | document.cookie = 'sidebar=expanded'; 81 | } 82 | 83 | function add_sidebar_button() { 84 | sidebarwrapper.css({ 85 | 'float': 'left', 86 | 'margin-right': '0', 87 | 'width': ssb_width_expanded - 13 88 | }); 89 | // create the button 90 | sidebar.append( 91 | '
«
' 92 | ); 93 | var sidebarbutton = $('#sidebarbutton'); 94 | sidebarbutton.find('span').css({ 95 | 'display': 'block', 96 | 'position': 'fixed', 97 | 'top': '50%' 98 | }); 99 | 100 | sidebarbutton.click(toggle_sidebar); 101 | sidebarbutton.attr('title', _('Collapse sidebar')); 102 | sidebarbutton.css({ 103 | 'border-radius': '0 5px 5px 0', 104 | 'color': '#444444', 105 | 'background-color': '#CCCCCC', 106 | 'font-size': '1.2em', 107 | 'cursor': 'pointer', 108 | 'height': '100%', 109 | 'padding-left': '1px', 110 | 'margin-left': ssb_width_expanded - 12 111 | }); 112 | 113 | sidebarbutton.hover( 114 | function () { 115 | $(this).css('background-color', dark_color); 116 | }, 117 | function () { 118 | $(this).css('background-color', light_color); 119 | } 120 | ); 121 | } 122 | 123 | function set_position_from_cookie() { 124 | if (!document.cookie) 125 | return; 126 | var items = document.cookie.split(';'); 127 | for(var k=0; k=3.8 10 | - aiohttp 11 | - lucit::lucit-licensing-python>=1.8.2 12 | - lucit::unicorn-binance-rest-api>=2.6.1 13 | - lucit::unicorn-binance-websocket-api>=2.8.1 14 | - cython>=3.0.10 15 | - requests>=2.31.0 16 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # UNICORN Binance Local Depth Cache - Examples 2 | Here you will find best practice examples for the use of the UNICORN Binance Local Depth Cache. 3 | 4 | For each example you will find a `README.md` and a `requirements.txt` to install any dependencies. The respective `*.py` 5 | file is to download and start, if an example does not work, we are happy about a 6 | [patch](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/fork) or a message via 7 | [GitHub Issue](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues/new/choose) or 8 | [our chat](https://www.lucit.tech/get-support.html). 9 | -------------------------------------------------------------------------------- /examples/binance_depthcache_limit_count/README.md: -------------------------------------------------------------------------------- 1 | # Binance DepthCache Limit the number of returned list elements. 2 | ## Overview 3 | Limit the number of returned list elements of `get_asks()` and `get_bids` with the parameter `limit_count`. 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python binance_us_depthcache.py 20 | ``` 21 | 22 | ### Graceful Shutdown: 23 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 24 | an unexpected exception. 25 | 26 | ## Logging 27 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 28 | file named after the script with a .log extension. 29 | 30 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 31 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/binance_depthcache_limit_count/binance_depthcache_limit_count.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | import asyncio 7 | import logging 8 | import os 9 | 10 | amount_test_caches: int = 40 11 | exchange: str = "binance.com" 12 | limit_count: int = 4 13 | 14 | logging.getLogger("unicorn_binance_local_depth_cache") 15 | logging.basicConfig(level=logging.DEBUG, 16 | filename=os.path.basename(__file__) + '.log', 17 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 18 | style="{") 19 | 20 | 21 | async def main(): 22 | ubra = ubldc.get_ubra_manager() 23 | exchange_info = ubra.get_exchange_info() 24 | markets = [] 25 | for item in exchange_info['symbols']: 26 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 27 | markets.append(item['symbol']) 28 | markets = markets[:amount_test_caches] 29 | 30 | print(f"Starting {exchange} DepthCaches for {len(markets)} markets: {markets}") 31 | ubldc.create_depthcache(markets=markets) 32 | 33 | while ubldc.is_stop_request() is False: 34 | add_string = (f"binance_api_status={ubra.get_used_weight(cached=True)}\r\n " 35 | f"---------------------------------------------------------------------------------------------") 36 | for market in markets: 37 | try: 38 | top_asks = ubldc.get_asks(market=market, limit_count=limit_count) 39 | top_bids = ubldc.get_bids(market=market, limit_count=limit_count) 40 | except DepthCacheOutOfSync: 41 | top_asks = "Out of sync!" 42 | top_bids = "Out of sync!" 43 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 44 | f" - top {limit_count} asks: {top_asks}\r\n " 45 | f" - top {limit_count} bids: {top_bids}") 46 | add_string = f"{add_string}\r\n {depth}" 47 | 48 | ubldc.print_summary(add_string=add_string) 49 | await asyncio.sleep(1) 50 | 51 | 52 | with BinanceLocalDepthCacheManager(exchange=exchange) as ubldc: 53 | try: 54 | asyncio.run(main()) 55 | except KeyboardInterrupt: 56 | print("\r\nGracefully stopping ...") 57 | except Exception as e: 58 | print(f"\r\nERROR: {e}") 59 | print("Gracefully stopping ...") 60 | -------------------------------------------------------------------------------- /examples/binance_depthcache_limit_count/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | -------------------------------------------------------------------------------- /examples/binance_depthcache_multi_markets/README.md: -------------------------------------------------------------------------------- 1 | # UBLDC Multi Markets 2 | ## Overview 3 | This example starts 40 DepthCaches with 1 second interval. 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python binance_depthcache_multi_markets.py 20 | ``` 21 | 22 | ### Graceful Shutdown: 23 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 24 | an unexpected exception. 25 | 26 | ## Logging 27 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 28 | file named after the script with a .log extension. 29 | 30 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 31 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/binance_depthcache_multi_markets/binance_depthcache_multi_markets.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager 6 | from typing import Optional 7 | import asyncio 8 | import logging 9 | import os 10 | 11 | 12 | amount_test_caches: int = 40 13 | exchange: str = "binance.com" 14 | update_interval_ms: int | None = None 15 | 16 | logging.getLogger("unicorn_binance_local_depth_cache") 17 | logging.basicConfig(level=logging.DEBUG, 18 | filename=os.path.basename(__file__) + '.log', 19 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 20 | style="{") 21 | 22 | 23 | async def main(): 24 | ubra = ubldc.get_ubra_manager() 25 | exchange_info = ubra.get_exchange_info() 26 | markets = [] 27 | for item in exchange_info['symbols']: 28 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 29 | markets.append(item['symbol']) 30 | markets = markets[:amount_test_caches] 31 | 32 | print(f"Starting {exchange} DepthCaches for {len(markets)} markets: {markets}") 33 | ubldc.create_depthcache(markets=markets) 34 | 35 | while ubldc.is_stop_request() is False: 36 | markets_synced: list = [] 37 | markets_not_synced: list = [] 38 | for market in markets: 39 | if ubldc.is_depth_cache_synchronized(market=market) is True: 40 | markets_synced.append(market) 41 | else: 42 | markets_not_synced.append(market) 43 | add_string = (f"---------------------------------------------------------------------------------------------" 44 | f"\r\n NOT SYNCED: {markets_not_synced}\r\n SYNCED: {markets_synced}") 45 | ubldc.print_summary(add_string=add_string) 46 | await asyncio.sleep(1) 47 | 48 | 49 | with BinanceLocalDepthCacheManager(exchange=exchange, 50 | init_time_window=5, 51 | websocket_ping_interval=10, 52 | websocket_ping_timeout=20, 53 | depth_cache_update_interval=update_interval_ms) as ubldc: 54 | try: 55 | asyncio.run(main()) 56 | except KeyboardInterrupt: 57 | print("\r\nGracefully stopping ...") 58 | except Exception as e: 59 | print(f"\r\nERROR: {e}") 60 | print("Gracefully stopping ...") 61 | -------------------------------------------------------------------------------- /examples/binance_depthcache_multi_markets/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | -------------------------------------------------------------------------------- /examples/binance_depthcache_threshold_volume/README.md: -------------------------------------------------------------------------------- 1 | # Binance DepthCache Limits the number of returned list items by volume. 2 | ## Overview 3 | Limit the number of returned list elements of `get_asks()` and `get_bids` by volume with the parameter 4 | `threshold_volume`. 5 | 6 | ## Prerequisites 7 | Ensure you have Python 3.7+ installed on your system. 8 | 9 | Before running the provided script, install the required Python packages: 10 | ```bash 11 | pip install -r requirements.txt 12 | ``` 13 | 14 | ## Get a UNICORN Binance Suite License 15 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 16 | 17 | ## Usage 18 | ### Running the Script: 19 | ```bash 20 | python binance_depthcache_threshold_volume.py 21 | ``` 22 | 23 | ### Graceful Shutdown: 24 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 25 | an unexpected exception. 26 | 27 | ## Logging 28 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 29 | file named after the script with a .log extension. 30 | 31 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 32 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/binance_depthcache_threshold_volume/binance_depthcache_threshold_volume.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | from typing import Optional 7 | import asyncio 8 | import logging 9 | import os 10 | 11 | amount_test_caches: int = 40 12 | exchange: str = "binance.com" 13 | update_interval_ms: Optional[int] = None 14 | threshold_volume: float = 200000.0 15 | 16 | logging.getLogger("unicorn_binance_local_depth_cache") 17 | logging.basicConfig(level=logging.DEBUG, 18 | filename=os.path.basename(__file__) + '.log', 19 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 20 | style="{") 21 | 22 | 23 | async def main(): 24 | ubra = ubldc.get_ubra_manager() 25 | exchange_info = ubra.get_exchange_info() 26 | markets = [] 27 | for item in exchange_info['symbols']: 28 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 29 | markets.append(item['symbol']) 30 | markets = markets[:amount_test_caches] 31 | 32 | print(f"Starting {exchange} DepthCaches for {len(markets)} markets: {markets}") 33 | ubldc.create_depthcache(markets=markets) 34 | 35 | while ubldc.is_stop_request() is False: 36 | add_string = (f"binance_api_status={ubra.get_used_weight(cached=True)}\r\n " 37 | f"---------------------------------------------------------------------------------------------") 38 | for market in markets: 39 | try: 40 | top_asks = ubldc.get_asks(market=market, threshold_volume=threshold_volume) 41 | top_bids = ubldc.get_bids(market=market, threshold_volume=threshold_volume) 42 | except DepthCacheOutOfSync: 43 | top_asks = "Out of sync!" 44 | top_bids = "Out of sync!" 45 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 46 | f" - top asks volume > {threshold_volume}: {top_asks}\r\n " 47 | f" - top bids volume > {threshold_volume}: {top_bids}") 48 | add_string = f"{add_string}\r\n {depth}" 49 | 50 | ubldc.print_summary(add_string=add_string) 51 | await asyncio.sleep(1) 52 | 53 | 54 | with BinanceLocalDepthCacheManager(exchange=exchange, 55 | init_time_window=5, 56 | websocket_ping_interval=10, 57 | websocket_ping_timeout=15, 58 | depth_cache_update_interval=update_interval_ms) as ubldc: 59 | try: 60 | asyncio.run(main()) 61 | except KeyboardInterrupt: 62 | print("\r\nGracefully stopping ...") 63 | except Exception as e: 64 | print(f"\r\nERROR: {e}") 65 | print("Gracefully stopping ...") 66 | -------------------------------------------------------------------------------- /examples/binance_depthcache_threshold_volume/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | -------------------------------------------------------------------------------- /examples/binance_futures_depthcache/README.md: -------------------------------------------------------------------------------- 1 | # Binance Futures DepthCache 2 | ## Overview 3 | Create DepthCaches for Binance Futures with `exchange="binance.com-futures"`. 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python binance_us_depthcache.py 20 | ``` 21 | 22 | ### Graceful Shutdown: 23 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 24 | an unexpected exception. 25 | 26 | ## Logging 27 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 28 | file named after the script with a .log extension. 29 | 30 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 31 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/binance_futures_depthcache/binance_futures_depthcache.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | from typing import Optional 7 | import asyncio 8 | import logging 9 | import os 10 | 11 | amount_test_caches: int = 40 12 | exchange: str = "binance.com-futures" 13 | limit_count: int = 4 14 | update_interval_ms: Optional[int] = None 15 | 16 | logging.getLogger("unicorn_binance_local_depth_cache") 17 | logging.basicConfig(level=logging.DEBUG, 18 | filename=os.path.basename(__file__) + '.log', 19 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 20 | style="{") 21 | 22 | 23 | async def main(): 24 | ubra = ubldc.get_ubra_manager() 25 | exchange_info = ubra.futures_exchange_info() 26 | markets = [] 27 | for item in exchange_info['symbols']: 28 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 29 | markets.append(item['symbol']) 30 | markets = markets[:amount_test_caches] 31 | 32 | print(f"Starting {exchange} DepthCaches for {len(markets)} markets: {markets}") 33 | ubldc.create_depthcache(markets=markets) 34 | 35 | while ubldc.is_stop_request() is False: 36 | add_string = (f"binance_api_status={ubra.get_used_weight(cached=True)}\r\n " 37 | f"---------------------------------------------------------------------------------------------") 38 | for market in markets: 39 | try: 40 | top_asks = ubldc.get_asks(market=market, limit_count=limit_count) 41 | top_bids = ubldc.get_bids(market=market, limit_count=limit_count) 42 | except DepthCacheOutOfSync: 43 | top_asks = "Out of sync!" 44 | top_bids = "Out of sync!" 45 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 46 | f" - top {limit_count} asks: {top_asks}\r\n " 47 | f" - top {limit_count} bids: {top_bids}") 48 | add_string = f"{add_string}\r\n {depth}" 49 | 50 | ubldc.print_summary(add_string=add_string) 51 | await asyncio.sleep(1) 52 | 53 | 54 | with BinanceLocalDepthCacheManager(exchange=exchange, 55 | init_time_window=5, 56 | websocket_ping_interval=10, 57 | websocket_ping_timeout=15, 58 | depth_cache_update_interval=update_interval_ms) as ubldc: 59 | try: 60 | asyncio.run(main()) 61 | except KeyboardInterrupt: 62 | print("\r\nGracefully stopping ...") 63 | except Exception as e: 64 | print(f"\r\nERROR: {e}") 65 | print("Gracefully stopping ...") 66 | -------------------------------------------------------------------------------- /examples/binance_futures_depthcache/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | -------------------------------------------------------------------------------- /examples/binance_us_depthcache/README.md: -------------------------------------------------------------------------------- 1 | # Binance US DepthCache 2 | ## Overview 3 | Create DepthCaches for Binance US with `exchange="binance.us"`. 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python binance_us_depthcache.py 20 | ``` 21 | 22 | ### Graceful Shutdown: 23 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 24 | an unexpected exception. 25 | 26 | ## Logging 27 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 28 | file named after the script with a .log extension. 29 | 30 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 31 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/binance_us_depthcache/binance_us_depthcache.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 6 | import asyncio 7 | import logging 8 | import os 9 | 10 | exchange: str = "binance.us" 11 | markets: list = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT'] 12 | limit_count: int = 4 13 | 14 | logging.getLogger("unicorn_binance_local_depth_cache") 15 | logging.basicConfig(level=logging.DEBUG, 16 | filename=os.path.basename(__file__) + '.log', 17 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 18 | style="{") 19 | 20 | 21 | async def main(): 22 | ubra = ubldc.get_ubra_manager() 23 | 24 | print(f"Starting {exchange} DepthCaches for {len(markets)} markets: {markets}") 25 | ubldc.create_depthcache(markets=markets) 26 | 27 | while ubldc.is_stop_request() is False: 28 | add_string = f"---------------------------------------------------------------------------------------------" 29 | for market in markets: 30 | try: 31 | top_asks = ubldc.get_asks(market=market, limit_count=limit_count) 32 | top_bids = ubldc.get_bids(market=market, limit_count=limit_count) 33 | except DepthCacheOutOfSync: 34 | top_asks = "Out of sync!" 35 | top_bids = "Out of sync!" 36 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 37 | f" - top {limit_count} asks: {top_asks}\r\n " 38 | f" - top {limit_count} bids: {top_bids}") 39 | add_string = f"{add_string}\r\n {depth}" 40 | 41 | ubldc.print_summary(add_string=add_string) 42 | await asyncio.sleep(1) 43 | 44 | 45 | with BinanceLocalDepthCacheManager(exchange=exchange, 46 | init_time_window=5, 47 | websocket_ping_interval=10, 48 | websocket_ping_timeout=15) as ubldc: 49 | try: 50 | asyncio.run(main()) 51 | except KeyboardInterrupt: 52 | print("\r\nGracefully stopping ...") 53 | except Exception as e: 54 | print(f"\r\nERROR: {e}") 55 | print("Gracefully stopping ...") 56 | -------------------------------------------------------------------------------- /examples/binance_us_depthcache/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | -------------------------------------------------------------------------------- /examples/ubldc-demo/README.md: -------------------------------------------------------------------------------- 1 | # UBLDC Demo 2 | ## Overview 3 | This is the original script from https://ubldc-demo.lucit.tech 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python ubdcc-demo.py 20 | ``` 21 | 22 | ### Graceful Shutdown: 23 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 24 | an unexpected exception. 25 | 26 | ## Logging 27 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 28 | file named after the script with a .log extension. 29 | 30 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 31 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/ubldc-demo/requirements.txt: -------------------------------------------------------------------------------- 1 | python-dotenv 2 | unicorn-binance-local-depth-cache>=2.0.0 3 | -------------------------------------------------------------------------------- /examples/ubldc-demo/ubldc-demo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheOutOfSync 7 | import asyncio 8 | import logging 9 | import os 10 | 11 | amount_test_caches: int = 5 12 | footer: str = "By LUCIT - www.lucit.tech" 13 | exchange: str = "binance.com-futures" 14 | limit_count: int = 2 15 | title: str = "UBLDC Demo" 16 | threshold_volume: float = 200000.0 17 | threshold_volume_limit_count: int = 3 18 | update_interval_ms: int = 100 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.DEBUG, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | load_dotenv() 26 | 27 | 28 | async def main(): 29 | ubra = ubldc.get_ubra_manager() 30 | exchange_info = ubra.futures_exchange_info() 31 | markets = [] 32 | for item in exchange_info['symbols']: 33 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 34 | markets.append(item['symbol']) 35 | markets = markets[:amount_test_caches] 36 | 37 | ubldc.create_depth_cache(markets=markets) 38 | while ubldc.is_stop_request() is False: 39 | add_string = f"---------------------------------------------------------------------------------------------" 40 | for market in markets: 41 | try: 42 | top_asks_limit = ubldc.get_asks(market=market, limit_count=limit_count) 43 | top_bids_limit = ubldc.get_bids(market=market, limit_count=limit_count) 44 | top_asks_threshold = ubldc.get_asks(market=market, 45 | limit_count=threshold_volume_limit_count, 46 | threshold_volume=threshold_volume) 47 | top_bids_threshold = ubldc.get_bids(market=market, 48 | limit_count=threshold_volume_limit_count, 49 | threshold_volume=threshold_volume) 50 | except DepthCacheOutOfSync: 51 | top_asks_limit = "Out of sync!" 52 | top_bids_limit = "Out of sync!" 53 | top_asks_threshold = "Out of sync!" 54 | top_bids_threshold = "Out of sync!" 55 | depth = (f"depth_cache '{market}' is in sync: {ubldc.is_depth_cache_synchronized(market=market)}\r\n " 56 | f"- top {limit_count} asks: {top_asks_limit}\r\n " 57 | f"- top {limit_count} bids: {top_bids_limit}\r\n " 58 | f"- top {threshold_volume_limit_count} asks vol. > {threshold_volume}: {top_asks_threshold}\r\n " 59 | f"- top {threshold_volume_limit_count} bids vol. > {threshold_volume}: {top_bids_threshold}") 60 | add_string = f"{add_string}\r\n {depth}" 61 | 62 | if os.getenv('EXPORT_TO_PNG') is None: 63 | ubldc.print_summary(add_string=add_string, footer=footer, title=title) 64 | await asyncio.sleep(1) 65 | else: 66 | ubldc.print_summary_to_png(add_string=add_string, 67 | height_per_row=13.5, 68 | print_summary_export_path="/var/www/html/", 69 | footer=footer, 70 | title=title) 71 | await asyncio.sleep(10) 72 | 73 | 74 | with BinanceLocalDepthCacheManager(exchange=exchange, 75 | auto_data_cleanup_stopped_streams=True, 76 | depth_cache_update_interval=update_interval_ms, 77 | websocket_ping_interval=10, 78 | websocket_ping_timeout=15) as ubldc: 79 | try: 80 | asyncio.run(main()) 81 | except KeyboardInterrupt: 82 | print("\r\nGracefully stopping ...") 83 | 84 | -------------------------------------------------------------------------------- /examples/ubldc_package_update_check/README.md: -------------------------------------------------------------------------------- 1 | # Get the Version and Update Info of this Package 2 | ## Overview 3 | This shows how to obtain information about new versions programmatically. 4 | 5 | ## Prerequisites 6 | Ensure you have Python 3.7+ installed on your system. 7 | 8 | Before running the provided script, install the required Python packages: 9 | ```bash 10 | pip install -r requirements.txt 11 | ``` 12 | 13 | ## Get a UNICORN Binance Suite License 14 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 15 | 16 | ## Usage 17 | ### Running the Script: 18 | ```bash 19 | python ubldc_package_update_check.py 20 | ``` 21 | 22 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 23 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). -------------------------------------------------------------------------------- /examples/ubldc_package_update_check/requirements.txt: -------------------------------------------------------------------------------- 1 | unicorn-binance-local-depth-cache>=2.0.0 2 | 3 | -------------------------------------------------------------------------------- /examples/ubldc_package_update_check/ubldc_package_update_check.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager 6 | 7 | with BinanceLocalDepthCacheManager(warn_on_update=False) as ubldc: 8 | if ubldc.is_update_available(): 9 | print(f"Please upgrade to {ubldc.get_latest_version()} you are on {ubldc.get_version()}") 10 | latest_release_info = ubldc.get_latest_release_info() 11 | if latest_release_info: 12 | print(f"Please download the latest release or run `pip install unicorn-binance-local-depth-cache --upgrade`" 13 | f":\r\n\ttar: {latest_release_info['tarball_url']}\r\n\tzip: {latest_release_info['zipball_url']}\r\n" 14 | f"release info:\r\n{latest_release_info['body']}") 15 | else: 16 | print(ubldc.get_version(), "is the latest version!") 17 | 18 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/.env-example: -------------------------------------------------------------------------------- 1 | API_SECRET=aaa 2 | LICENSE_TOKEN=bbb 3 | UBDCC_ADDRESS=10.0.0.1 4 | UBDCC_PORT=80 -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/README.md: -------------------------------------------------------------------------------- 1 | # UNICORN DepthCache Cluster for Binance 2 | A highly scalable Kubernetes application from LUCIT to manage multiple and redundant UNICORN Binance Local Depth Cache 3 | Instances on a Kubernetes Cluster for high-frequency access to Binance's DepthCache data (order books). 4 | 5 | [UNICORN DepthCache Cluster for Binance](https://github.com/LUCIT-Systems-and-Development/unicorn-depthcache-cluster-for-binance) 6 | 7 | ## Overview 8 | Instead of creating and using local DepthCaches, we connect to a UNICORN DepthCache Cluster for Binance. 9 | 10 | ## Prerequisites 11 | Ensure you have Python 3.7+ installed on your system. 12 | 13 | Before running the provided script, install the required Python packages: 14 | ```bash 15 | pip install -r requirements.txt 16 | ``` 17 | 18 | And set up your `.env` file! 19 | 20 | ## Get a UNICORN Binance Suite License 21 | To run modules of the *UNICORN Binance Suite* you need a [valid license](https://shop.lucit.services)! 22 | 23 | ## Usage 24 | ### Running the Script: 25 | ```bash 26 | python xxx.py 27 | ``` 28 | 29 | ### Graceful Shutdown: 30 | The script is designed to handle a graceful shutdown upon receiving a KeyboardInterrupt (e.g., Ctrl+C) or encountering 31 | an unexpected exception. 32 | 33 | ## Logging 34 | The script employs logging to provide insights into its operation and to assist in troubleshooting. Logs are saved to a 35 | file named after the script with a .log extension. 36 | 37 | For further assistance or to report issues, please [contact our support team](https://www.lucit.tech/get-support.html) 38 | or [visit our GitHub repository](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache). 39 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/create-depthcaches-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | from unicorn_binance_rest_api import BinanceRestApiManager 9 | import asyncio 10 | import logging 11 | import os 12 | 13 | load_dotenv() 14 | 15 | exchange: str = "binance.com" 16 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 17 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 18 | 19 | logging.getLogger("unicorn_binance_local_depth_cache") 20 | logging.basicConfig(level=logging.ERROR, 21 | filename=os.path.basename(__file__) + '.log', 22 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 23 | style="{") 24 | 25 | 26 | async def main(): 27 | with BinanceRestApiManager(exchange=exchange) as ubra: 28 | if exchange == "binance.com" or exchange == "binance.us": 29 | exchange_info = ubra.get_exchange_info() 30 | elif exchange == "binance.com-futures": 31 | exchange_info = ubra.futures_exchange_info() 32 | else: 33 | raise ValueError(f"Unknown exchange: {exchange}") 34 | markets = [] 35 | for item in exchange_info['symbols']: 36 | if item['status'] == "TRADING": 37 | markets.append(item['symbol']) 38 | result = await ubldc.cluster.create_depthcaches_async(exchange=exchange, markets=markets[1200:], desired_quantity=1) 39 | print(f"Adding {len(markets)} DepthCaches for exchange '{exchange}' on UBDCC '{ubdcc_address}':") 40 | pprint(result) 41 | 42 | try: 43 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 44 | try: 45 | asyncio.run(main()) 46 | except KeyboardInterrupt: 47 | print("\r\nGracefully stopping ...") 48 | except Exception as error_msg: 49 | print(f"ERROR: {error_msg}") 50 | except DepthCacheClusterNotReachableError as error_msg: 51 | print(f"ERROR: {error_msg}") 52 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/create-depthcaches-sequential-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | from unicorn_binance_rest_api import BinanceRestApiManager 9 | import asyncio 10 | import logging 11 | import os 12 | 13 | 14 | load_dotenv() 15 | 16 | exchange: str = "binance.com-futures" 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | with BinanceRestApiManager(exchange=exchange) as ubra: 29 | if exchange == "binance.com" or exchange == "binance.us": 30 | exchange_info = ubra.get_exchange_info() 31 | elif exchange == "binance.com-futures": 32 | exchange_info = ubra.futures_exchange_info() 33 | else: 34 | raise ValueError(f"Unknown exchange: {exchange}") 35 | markets = [] 36 | for item in exchange_info['symbols']: 37 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 38 | markets.append(item['symbol']) 39 | markets = markets[:210] 40 | print(f"Adding {len(markets)} DepthCaches for exchange '{exchange}' on UBDCC '{ubdcc_address}':") 41 | for market in markets: 42 | result = await ubldc.cluster.create_depthcache_async(exchange=exchange, market=market, 43 | desired_quantity=3, debug=True) 44 | pprint(result) 45 | 46 | try: 47 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 48 | try: 49 | asyncio.run(main()) 50 | except KeyboardInterrupt: 51 | print("\r\nGracefully stopping ...") 52 | except DepthCacheClusterNotReachableError as error_msg: 53 | print(f"ERROR: {error_msg}") 54 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/create-depthcaches-sequential.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | from unicorn_binance_rest_api import BinanceRestApiManager 9 | import asyncio 10 | import logging 11 | import os 12 | 13 | 14 | load_dotenv() 15 | 16 | exchange: str = "binance.com-futures" 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | with BinanceRestApiManager(exchange=exchange) as ubra: 29 | if exchange == "binance.com" or exchange == "binance.us": 30 | exchange_info = ubra.get_exchange_info() 31 | elif exchange == "binance.com-futures": 32 | exchange_info = ubra.futures_exchange_info() 33 | else: 34 | raise ValueError(f"Unknown exchange: {exchange}") 35 | markets = [] 36 | for item in exchange_info['symbols']: 37 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 38 | markets.append(item['symbol']) 39 | markets = markets[:210] 40 | print(f"Adding {len(markets)} DepthCaches for exchange '{exchange}' on UBDCC '{ubdcc_address}':") 41 | for market in markets: 42 | result = ubldc.cluster.create_depthcache(exchange=exchange, market=market, desired_quantity=3, debug=True) 43 | pprint(result) 44 | await asyncio.sleep(2.25) 45 | 46 | try: 47 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 48 | try: 49 | asyncio.run(main()) 50 | except KeyboardInterrupt: 51 | print("\r\nGracefully stopping ...") 52 | except DepthCacheClusterNotReachableError as error_msg: 53 | print(f"ERROR: {error_msg}") 54 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/create-depthcaches.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | from unicorn_binance_rest_api import BinanceRestApiManager 9 | import asyncio 10 | import logging 11 | import os 12 | 13 | load_dotenv() 14 | 15 | exchange: str = "binance.com-futures" 16 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 17 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 18 | 19 | logging.getLogger("unicorn_binance_local_depth_cache") 20 | logging.basicConfig(level=logging.ERROR, 21 | filename=os.path.basename(__file__) + '.log', 22 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 23 | style="{") 24 | 25 | 26 | async def main(): 27 | with BinanceRestApiManager(exchange=exchange) as ubra: 28 | if exchange == "binance.com" or exchange == "binance.us": 29 | exchange_info = ubra.get_exchange_info() 30 | elif exchange == "binance.com-futures": 31 | exchange_info = ubra.futures_exchange_info() 32 | else: 33 | raise ValueError(f"Unknown exchange: {exchange}") 34 | markets = [] 35 | for item in exchange_info['symbols']: 36 | if item['symbol'].endswith("USDT") and item['status'] == "TRADING": 37 | markets.append(item['symbol']) 38 | markets = markets[:210] 39 | result = ubldc.cluster.create_depthcaches(exchange=exchange, markets=markets, desired_quantity=3, debug=True) 40 | print(f"Adding {len(markets)} DepthCaches for exchange '{exchange}' on UBDCC '{ubdcc_address}':") 41 | pprint(result) 42 | 43 | try: 44 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 45 | try: 46 | asyncio.run(main()) 47 | except KeyboardInterrupt: 48 | print("\r\nGracefully stopping ...") 49 | except DepthCacheClusterNotReachableError as error_msg: 50 | print(f"ERROR: {error_msg}") 51 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/get-cluster-info-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | import asyncio 6 | import logging 7 | import os 8 | from dotenv import load_dotenv 9 | from pprint import pprint 10 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | markets: list = ['1000SHIBUSDT', 'BTCUSDT', 'ETHUSDT'] 16 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 17 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 18 | 19 | logging.getLogger("unicorn_binance_local_depth_cache") 20 | logging.basicConfig(level=logging.ERROR, 21 | filename=os.path.basename(__file__) + '.log', 22 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 23 | style="{") 24 | 25 | 26 | async def main(): 27 | pprint(await ubldc.cluster.get_cluster_info_async(debug=True)) 28 | await asyncio.sleep(1) 29 | 30 | try: 31 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 32 | try: 33 | asyncio.run(main()) 34 | except KeyboardInterrupt: 35 | print("\r\nGracefully stopping ...") 36 | except DepthCacheClusterNotReachableError as error_msg: 37 | print(f"ERROR: {error_msg}") 38 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/get-cluster-info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | import asyncio 6 | import logging 7 | import os 8 | from dotenv import load_dotenv 9 | from pprint import pprint 10 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | markets: list = ['1000SHIBUSDT', 'BTCUSDT', 'ETHUSDT'] 16 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 17 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 18 | 19 | logging.getLogger("unicorn_binance_local_depth_cache") 20 | logging.basicConfig(level=logging.ERROR, 21 | filename=os.path.basename(__file__) + '.log', 22 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 23 | style="{") 24 | 25 | 26 | async def main(): 27 | pprint(ubldc.cluster.get_cluster_info(debug=True)) 28 | await asyncio.sleep(1) 29 | 30 | try: 31 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 32 | try: 33 | asyncio.run(main()) 34 | except KeyboardInterrupt: 35 | print("\r\nGracefully stopping ...") 36 | except DepthCacheClusterNotReachableError as error_msg: 37 | print(f"ERROR: {error_msg}") 38 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/requirements.txt: -------------------------------------------------------------------------------- 1 | python-dotenv 2 | unicorn-binance-local-depth-cache>=2.2.0 3 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/stop-all-depthcaches-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | import asyncio 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 16 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 17 | 18 | logging.getLogger("unicorn_binance_local_depth_cache") 19 | logging.basicConfig(level=logging.ERROR, 20 | filename=os.path.basename(__file__) + '.log', 21 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 22 | style="{") 23 | 24 | 25 | async def main(): 26 | dc = await ubldc.cluster.get_depthcache_list_async() 27 | for dcl_exchange in dc['depthcache_list']: 28 | print(f"Stopping {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on UBDCC " 29 | f"'{ubdcc_address}'!") 30 | loop = 1 31 | for market in dc['depthcache_list'][dcl_exchange]: 32 | print(f"Stopping DepthCache #{loop}: {market}") 33 | pprint(ubldc.cluster.stop_depthcache(exchange=dcl_exchange, market=market, debug=False)) 34 | loop += 1 35 | await asyncio.sleep(1) 36 | 37 | try: 38 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 39 | try: 40 | asyncio.run(main()) 41 | except KeyboardInterrupt: 42 | print("\r\nGracefully stopping ...") 43 | except DepthCacheClusterNotReachableError as error_msg: 44 | print(f"ERROR: {error_msg}") 45 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/stop-all-depthcaches.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | import asyncio 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 16 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 17 | 18 | logging.getLogger("unicorn_binance_local_depth_cache") 19 | logging.basicConfig(level=logging.ERROR, 20 | filename=os.path.basename(__file__) + '.log', 21 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 22 | style="{") 23 | 24 | 25 | async def main(): 26 | dc = ubldc.cluster.get_depthcache_list() 27 | for dcl_exchange in dc['depthcache_list']: 28 | print(f"Stopping {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on UBDCC " 29 | f"'{ubdcc_address}'!") 30 | loop = 1 31 | for market in dc['depthcache_list'][dcl_exchange]: 32 | print(f"Stopping DepthCache #{loop}: {market}") 33 | pprint(ubldc.cluster.stop_depthcache(exchange=dcl_exchange, market=market, debug=True)) 34 | loop += 1 35 | await asyncio.sleep(1) 36 | 37 | try: 38 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 39 | try: 40 | asyncio.run(main()) 41 | except KeyboardInterrupt: 42 | print("\r\nGracefully stopping ...") 43 | except DepthCacheClusterNotReachableError as error_msg: 44 | print(f"ERROR: {error_msg}") 45 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/submit-license-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | import asyncio 7 | import logging 8 | import os 9 | from pprint import pprint 10 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 11 | 12 | load_dotenv() 13 | 14 | api_secret: str = os.getenv('API_SECRET') 15 | footer: str = "By LUCIT - www.lucit.tech" 16 | exchange: str = "binance.com-futures" 17 | license_token: str = os.getenv('LICENSE_TOKEN') 18 | limit_count: int = 2 19 | markets: list = ['1000SHIBUSDT', 'BTCUSDT', 'ETHUSDT'] 20 | title: str = "UBDCC Demo" 21 | threshold_volume: float = 200000.0 22 | threshold_volume_limit_count: int = 3 23 | update_interval_ms: int = 100 24 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 25 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 26 | 27 | 28 | logging.getLogger("unicorn_binance_local_depth_cache") 29 | logging.basicConfig(level=logging.ERROR, 30 | filename=os.path.basename(__file__) + '.log', 31 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 32 | style="{") 33 | 34 | 35 | async def main(): 36 | pprint(await ubldc.cluster.submit_license_async(api_secret=api_secret, license_token=license_token, debug=False)) 37 | 38 | try: 39 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 40 | try: 41 | asyncio.run(main()) 42 | except KeyboardInterrupt: 43 | print("\r\nGracefully stopping ...") 44 | except Exception as error_msg: 45 | print(f"ERROR: {error_msg}") 46 | except DepthCacheClusterNotReachableError as error_msg: 47 | print(f"ERROR: {error_msg}") 48 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/submit-license.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | import asyncio 7 | import logging 8 | import os 9 | from pprint import pprint 10 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 11 | 12 | load_dotenv() 13 | 14 | api_secret: str = os.getenv('API_SECRET') 15 | footer: str = "By LUCIT - www.lucit.tech" 16 | exchange: str = "binance.com-futures" 17 | license_token: str = os.getenv('LICENSE_TOKEN') 18 | limit_count: int = 2 19 | markets: list = ['1000SHIBUSDT', 'BTCUSDT', 'ETHUSDT'] 20 | title: str = "UBDCC Demo" 21 | threshold_volume: float = 200000.0 22 | threshold_volume_limit_count: int = 3 23 | update_interval_ms: int = 100 24 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 25 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 26 | 27 | 28 | logging.getLogger("unicorn_binance_local_depth_cache") 29 | logging.basicConfig(level=logging.ERROR, 30 | filename=os.path.basename(__file__) + '.log', 31 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 32 | style="{") 33 | 34 | 35 | async def main(): 36 | pprint(ubldc.cluster.submit_license(api_secret=api_secret, license_token=license_token, debug=True)) 37 | 38 | try: 39 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 40 | try: 41 | asyncio.run(main()) 42 | except KeyboardInterrupt: 43 | print("\r\nGracefully stopping ...") 44 | except Exception as error_msg: 45 | print(f"ERROR: {error_msg}") 46 | except DepthCacheClusterNotReachableError as error_msg: 47 | print(f"ERROR: {error_msg}") 48 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/test-all-depthcaches-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | import asyncio 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com" 15 | limit_count: int = 2 16 | threshold_volume: float = 20000.0 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | dc = await ubldc.cluster.get_depthcache_list_async(debug=False) 29 | errors = {} 30 | non_working_caches = [] 31 | working_caches = [] 32 | for dcl_exchange in dc['depthcache_list']: 33 | print(f"Testing {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on UBDCC " 34 | f"'{ubdcc_address}'!") 35 | loop = 1 36 | for market in dc['depthcache_list'][dcl_exchange]: 37 | asks = await ubldc.cluster.get_asks_async(exchange=dcl_exchange, market=market, limit_count=limit_count, 38 | threshold_volume=threshold_volume, debug=True) 39 | if asks.get('error_id') is not None: 40 | print(f"Asks from DepthCache #{loop} '{market}' failed: {asks.get('error_id')} - {asks.get('message')}") 41 | pprint(asks) 42 | errors[asks.get('error_id')] = 1 if errors.get(asks.get('error_id')) is None else errors.get(asks.get('error_id')) + 1 43 | non_working_caches.append(market) 44 | else: 45 | print(f"Asks from DepthCache #{loop} '{market}':") 46 | pprint(asks) 47 | working_caches.append(market) 48 | loop += 1 49 | 50 | print(f"Successful working caches: {len(working_caches)}") 51 | if len(errors) > 0: 52 | print(f"ERRORS:") 53 | pprint(errors) 54 | await asyncio.sleep(1) 55 | 56 | try: 57 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 58 | try: 59 | asyncio.run(main()) 60 | except KeyboardInterrupt: 61 | print("\r\nGracefully stopping ...") 62 | except Exception as error_msg: 63 | print(f"ERROR: {error_msg}") 64 | except DepthCacheClusterNotReachableError as error_msg: 65 | print(f"ERROR: {error_msg}") 66 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/test-all-depthcaches-long-term-async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 7 | import asyncio 8 | import datetime 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | limit_count: int = 2 16 | threshold_volume: float = 200000.0 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | while True: 29 | dc = await ubldc.cluster.get_depthcache_list_async(debug=True) 30 | errors = {} 31 | non_working_caches = [] 32 | working_caches = [] 33 | for dcl_exchange in dc['depthcache_list']: 34 | print(f"Testing {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on " 35 | f"UBDCC '{ubdcc_address}' at {datetime.datetime.now()}!") 36 | for market in dc['depthcache_list'][dcl_exchange]: 37 | asks = await ubldc.cluster.get_bids_async(exchange=dcl_exchange, market=market, limit_count=limit_count, 38 | threshold_volume=threshold_volume) 39 | if asks.get('error_id') is not None: 40 | errors[asks.get('error_id')] = 1 if errors.get(asks.get('error_id')) is None else errors.get(asks.get('error_id')) + 1 41 | non_working_caches.append(market) 42 | else: 43 | working_caches.append(market) 44 | print(f"Successful working caches: {len(working_caches)}") 45 | for error in errors: 46 | print(f"ERROR: {error}: {errors[error]}") 47 | await asyncio.sleep(1) 48 | 49 | try: 50 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 51 | try: 52 | asyncio.run(main()) 53 | except KeyboardInterrupt: 54 | print("\r\nGracefully stopping ...") 55 | except Exception as error_msg: 56 | print(f"ERROR: {error_msg}") 57 | except DepthCacheClusterNotReachableError as error_msg: 58 | print(f"ERROR: {error_msg}") 59 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/test-all-depthcaches-long-term.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 7 | import asyncio 8 | import datetime 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | limit_count: int = 2 16 | threshold_volume: float = 200000.0 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | while True: 29 | dc = ubldc.cluster.get_depthcache_list() 30 | errors = {} 31 | non_working_caches = [] 32 | working_caches = [] 33 | for dcl_exchange in dc['depthcache_list']: 34 | print(f"Testing {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on " 35 | f"UBDCC '{ubdcc_address}' at {datetime.datetime.now()}!") 36 | for market in dc['depthcache_list'][dcl_exchange]: 37 | asks = ubldc.cluster.get_asks(exchange=dcl_exchange, market=market, 38 | limit_count=limit_count, threshold_volume=threshold_volume) 39 | if asks.get('error_id') is not None: 40 | errors[asks.get('error_id')] = 1 if errors.get(asks.get('error_id')) is None else errors.get(asks.get('error_id')) + 1 41 | non_working_caches.append(market) 42 | else: 43 | working_caches.append(market) 44 | print(f"Successful working caches: {len(working_caches)}") 45 | for error in errors: 46 | print(f"ERROR: {error}: {errors[error]}") 47 | await asyncio.sleep(1) 48 | 49 | try: 50 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 51 | try: 52 | asyncio.run(main()) 53 | except KeyboardInterrupt: 54 | print("\r\nGracefully stopping ...") 55 | except DepthCacheClusterNotReachableError as error_msg: 56 | print(f"ERROR: {error_msg}") 57 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/test-all-depthcaches.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from pprint import pprint 7 | from unicorn_binance_local_depth_cache import BinanceLocalDepthCacheManager, DepthCacheClusterNotReachableError 8 | import asyncio 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | exchange: str = "binance.com-futures" 15 | limit_count: int = 2 16 | threshold_volume: float = 200000.0 17 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 18 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 19 | 20 | logging.getLogger("unicorn_binance_local_depth_cache") 21 | logging.basicConfig(level=logging.ERROR, 22 | filename=os.path.basename(__file__) + '.log', 23 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 24 | style="{") 25 | 26 | 27 | async def main(): 28 | dc = ubldc.cluster.get_depthcache_list(debug=True) 29 | errors = {} 30 | non_working_caches = [] 31 | working_caches = [] 32 | for dcl_exchange in dc['depthcache_list']: 33 | print(f"Testing {len(dc['depthcache_list'][dcl_exchange])} DepthCaches for exchange '{dcl_exchange}' on UBDCC " 34 | f"'{ubdcc_address}'!") 35 | loop = 1 36 | for market in dc['depthcache_list'][dcl_exchange]: 37 | asks = ubldc.cluster.get_asks(exchange=dcl_exchange, market=market, 38 | limit_count=limit_count, threshold_volume=threshold_volume, debug=True) 39 | if asks.get('error_id') is not None: 40 | print(f"Asks from DepthCache #{loop} '{market}' failed: {asks.get('error_id')} - {asks.get('message')}") 41 | pprint(asks) 42 | errors[asks.get('error_id')] = 1 if errors.get(asks.get('error_id')) is None else errors.get(asks.get('error_id')) + 1 43 | non_working_caches.append(market) 44 | else: 45 | print(f"Asks from DepthCache #{loop} '{market}':") 46 | pprint(asks) 47 | working_caches.append(market) 48 | loop += 1 49 | 50 | print(f"Successful working caches: {len(working_caches)}") 51 | if len(errors) > 0: 52 | print(f"ERRORS:") 53 | pprint(errors) 54 | await asyncio.sleep(1) 55 | 56 | try: 57 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 58 | try: 59 | asyncio.run(main()) 60 | except KeyboardInterrupt: 61 | print("\r\nGracefully stopping ...") 62 | except DepthCacheClusterNotReachableError as error_msg: 63 | print(f"ERROR: {error_msg}") 64 | -------------------------------------------------------------------------------- /examples/unicorn_depthcache_cluster_for_binance/ubdcc-demo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from dotenv import load_dotenv 6 | from unicorn_binance_local_depth_cache import (BinanceLocalDepthCacheManager, DepthCacheOutOfSync, 7 | DepthCacheClusterNotReachableError) 8 | import asyncio 9 | import logging 10 | import os 11 | 12 | load_dotenv() 13 | 14 | footer: str = "By LUCIT - www.lucit.tech" 15 | exchange: str = "binance.com-futures" 16 | limit_count: int = 2 17 | markets: list = ['1000SHIBUSDT', 'BTCUSDT', 'ETHUSDT'] 18 | title: str = "UBDCC Demo" 19 | threshold_volume: float = 200000.0 20 | threshold_volume_limit_count: int = 3 21 | ubdcc_address: str = os.getenv('UBDCC_ADDRESS') 22 | ubdcc_port: int = int(os.getenv('UBDCC_PORT')) 23 | update_interval_ms: int = 100 24 | 25 | 26 | logging.getLogger("unicorn_binance_local_depth_cache") 27 | logging.basicConfig(level=logging.ERROR, 28 | filename=os.path.basename(__file__) + '.log', 29 | format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", 30 | style="{") 31 | 32 | 33 | async def main(): 34 | ubldc.cluster.create_depthcache(markets=markets) 35 | while ubldc.is_stop_request() is False: 36 | dividing_line = f"---------------------------------------------------------------------------------------------" 37 | add_string = dividing_line 38 | for market in markets: 39 | try: 40 | top_asks_limit = ubldc.cluster.get_asks(market=market, limit_count=limit_count) 41 | top_bids_limit = ubldc.cluster.get_bids(market=market, limit_count=limit_count) 42 | top_asks_threshold = ubldc.cluster.get_asks(market=market, 43 | limit_count=threshold_volume_limit_count, 44 | threshold_volume=threshold_volume) 45 | top_bids_threshold = ubldc.cluster.get_bids(market=market, 46 | limit_count=threshold_volume_limit_count, 47 | threshold_volume=threshold_volume) 48 | except DepthCacheOutOfSync: 49 | top_asks_limit = "Out of sync!" 50 | top_bids_limit = "Out of sync!" 51 | top_asks_threshold = "Out of sync!" 52 | top_bids_threshold = "Out of sync!" 53 | depth = (f"depth_cache '{market}' is in sync: \r\n " 54 | f"- top {limit_count} asks: {top_asks_limit}\r\n " 55 | f"- top {limit_count} bids: {top_bids_limit}\r\n " 56 | f"- top {threshold_volume_limit_count} asks vol. > {threshold_volume}: {top_asks_threshold}\r\n " 57 | f"- top {threshold_volume_limit_count} bids vol. > {threshold_volume}: {top_bids_threshold}") 58 | add_string = f"{add_string}\r\n {depth}" 59 | add_string = f"{add_string}\r\n {dividing_line}" 60 | add_string = f"{add_string}\r\n UBDCC status: {ubldc.cluster.get_cluster_info()['result']}" 61 | ubldc.print_summary(add_string=add_string, footer=footer, title=title) 62 | await asyncio.sleep(1) 63 | 64 | try: 65 | with BinanceLocalDepthCacheManager(exchange=exchange, ubdcc_address=ubdcc_address, ubdcc_port=ubdcc_port) as ubldc: 66 | try: 67 | asyncio.run(main()) 68 | except KeyboardInterrupt: 69 | print("\r\nGracefully stopping ...") 70 | except DepthCacheClusterNotReachableError as error_msg: 71 | print(f"ERROR: {error_msg}") 72 | -------------------------------------------------------------------------------- /images/logo/LUCIT-UBLDC-Banner-Readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/logo/LUCIT-UBLDC-Banner-Readme.png -------------------------------------------------------------------------------- /images/logo/LUCIT-UBLDC-Logo-Big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/logo/LUCIT-UBLDC-Logo-Big.png -------------------------------------------------------------------------------- /images/logo/LUCIT-UBLDC-Logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/logo/LUCIT-UBLDC-Logo.ai -------------------------------------------------------------------------------- /images/logo/LUCIT-UBLDC-Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/logo/LUCIT-UBLDC-Logo.png -------------------------------------------------------------------------------- /images/misc/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/heart.png -------------------------------------------------------------------------------- /images/misc/icinga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/icinga.png -------------------------------------------------------------------------------- /images/misc/ipython.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/ipython.png -------------------------------------------------------------------------------- /images/misc/ok-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/ok-icon.png -------------------------------------------------------------------------------- /images/misc/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/star.png -------------------------------------------------------------------------------- /images/misc/thumbup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/thumbup.png -------------------------------------------------------------------------------- /images/misc/watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/watch.png -------------------------------------------------------------------------------- /images/misc/x-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/707f1808c9051e990178a14f9e2d17f334b13075/images/misc/x-icon.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "unicorn-binance-local-depth-cache" 3 | version = "2.8.0" 4 | description = "A Python SDK by LUCIT for accessing and managing multiple local Binance order books with Python in a simple, fast, flexible, robust and fully featured way." 5 | authors = ["LUCIT Systems and Development "] 6 | license = "LSOSL - LUCIT Synergetic Open Source License" 7 | readme = "README.md" 8 | homepage = "https://www.lucit.tech/unicorn-binance-local-depth-cache.html" 9 | documentation = "https://unicorn-binance-local-depth-cache.docs.lucit.tech" 10 | repository = "https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache" 11 | 12 | [tool.poetry.urls] 13 | 'Howto' = 'https://www.lucit.tech/unicorn-binance-local-depth-cache.html#howto' 14 | 'Documentation' = 'https://unicorn-binance-local-depth-cache.docs.lucit.tech' 15 | 'Wiki' = 'https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/wiki' 16 | 'Author' = 'https://www.lucit.tech' 17 | 'Changes' = 'https://unicorn-binance-local-depth-cache.docs.lucit.tech/changelog.html' 18 | 'License' = 'https://unicorn-binance-local-depth-cache.docs.lucit.tech/license.html' 19 | 'Issue Tracker' = 'https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues' 20 | 'Telegram' = 'https://t.me/unicorndevs' 21 | 'Chat' = 'https://app.gitter.im/#/room/#unicorn-binance-suite_unicorn-binance-local-depth-cache:gitter.im' 22 | 'Get Support' = 'https://www.lucit.tech/get-support.html' 23 | 'LUCIT Online Shop' = 'https://shop.lucit.services/software/unicorn-binance-suite' 24 | 25 | [tool.poetry.dependencies] 26 | python = ">=3.8.0" 27 | aiohttp = "*" 28 | Cython = "*" 29 | lucit-licensing-python = ">=1.8.2" 30 | requests = ">=2.31.0" 31 | unicorn-binance-rest-api = ">=2.6.1" 32 | unicorn-binance-websocket-api = ">=2.8.1" 33 | 34 | [tool.poetry.dev-dependencies] 35 | 36 | [build-system] 37 | requires = ["setuptools", "wheel", "Cython", "pip", "mypy"] 38 | build-backend = "setuptools.build_meta" 39 | 40 | [tool.poetry.package_data] 41 | unicorn_binance_local_depth_cache = ["*.so", "*.dll", "*.py", "*.pyd", "*.pyi"] -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Changes must also be made in the following files: 2 | # ./environment.yml 3 | # ./meta.yaml 4 | # ./pyproject.toml 5 | # ./setup.py 6 | 7 | aiohttp 8 | Cython>=3.0.10 9 | lucit-licensing-python>=1.8.2 10 | requests>=2.32.3 11 | unicorn-binance-rest-api>=2.6.1 12 | unicorn-binance-websocket-api>=2.8.0 13 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # File: setup.py 5 | # 6 | # Part of ‘UNICORN Binance Local Depth Cache’ 7 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 9 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2023, LUCIT Systems and Development (https://www.lucit.tech) 19 | # All rights reserved. 20 | 21 | from Cython.Build import cythonize 22 | from setuptools import setup, find_packages, Extension 23 | import os 24 | import shutil 25 | import subprocess 26 | 27 | name = "unicorn-binance-local-depth-cache" 28 | source_dir = "unicorn_binance_local_depth_cache" 29 | 30 | stubs_dir = "stubs" 31 | extensions = [ 32 | Extension("*", [f"{source_dir}/*.py"]), 33 | ] 34 | 35 | # Setup 36 | GEN_STUBS = True 37 | for filename in os.listdir(source_dir): 38 | if filename.endswith('.pyi'): 39 | GEN_STUBS = False 40 | if GEN_STUBS is False: 41 | print("Skipping stub files ...") 42 | else: 43 | print("Generating stub files ...") 44 | os.makedirs(stubs_dir, exist_ok=True) 45 | for filename in os.listdir(source_dir): 46 | if filename.endswith('.py'): 47 | source_path = os.path.join(source_dir, filename) 48 | subprocess.run(['stubgen', '-o', stubs_dir, source_path], check=True) 49 | for stub_file in os.listdir(os.path.join(stubs_dir, source_dir)): 50 | if stub_file.endswith('.pyi'): 51 | source_stub_path = os.path.join(stubs_dir, source_dir, stub_file) 52 | if os.path.exists(os.path.join(source_dir, stub_file)): 53 | print(f"Skipped moving {source_stub_path} because {os.path.join(source_dir, stub_file)} already exists!") 54 | else: 55 | shutil.move(source_stub_path, source_dir) 56 | print(f"Moved {source_stub_path} to {source_dir}!") 57 | shutil.rmtree(os.path.join(stubs_dir)) 58 | print("Stub files generated and moved successfully.") 59 | 60 | with open("README.md", "r") as fh: 61 | print("Using README.md content as `long_description` ...") 62 | long_description = fh.read() 63 | 64 | setup( 65 | name=name, 66 | version="2.8.0", 67 | author="LUCIT Systems and Development", 68 | author_email='info@lucit.tech', 69 | url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache", 70 | description="A Python SDK by LUCIT for accessing and managing multiple local Binance order books with Python in a " 71 | "simple, fast, flexible, robust and fully featured way. .", 72 | long_description=long_description, 73 | long_description_content_type="text/markdown", 74 | license='LSOSL - LUCIT Synergetic Open Source License', 75 | install_requires=['aiohttp', 'lucit-licensing-python>=1.8.2', 'Cython>=3.0.10', 'requests>=2.32.3', 76 | 'unicorn-binance-websocket-api>=2.8.1', 'unicorn-binance-rest-api>=2.6.1'], 77 | keywords='binance, depth cache', 78 | project_urls={ 79 | 'Documentation': 'https://unicorn-binance-local-depth-cache.docs.lucit.tech', 80 | 'Wiki': 'https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/wiki', 81 | 'Author': 'https://www.lucit.tech', 82 | 'Changes': 'https://unicorn-binance-local-depth-cache.docs.lucit.tech/changelog.html', 83 | 'License': 'https://unicorn-binance-local-depth-cache.docs.lucit.tech/license.html', 84 | 'Issue Tracker': 'https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/issues', 85 | 'Chat': 'https://gitter.im/unicorn-binance-suite/unicorn-binance-local-depth-cache', 86 | 'Telegram': 'https://t.me/unicorndevs', 87 | 'Get Support': 'https://www.lucit.tech/get-support.html', 88 | 'LUCIT Online Shop': 'https://shop.lucit.services/software', 89 | }, 90 | packages=find_packages(exclude=[f"dev/{source_dir}"], include=[source_dir]), 91 | ext_modules=cythonize(extensions, compiler_directives={'language_level': "3"}), 92 | python_requires='>=3.8.0', 93 | package_data={'': ['*.so', '*.dll', '*.py', '*.pyd', '*.pyi']}, 94 | include_package_data=True, 95 | classifiers=[ 96 | "Development Status :: 5 - Production/Stable", 97 | "Programming Language :: Python :: 3.8", 98 | "Programming Language :: Python :: 3.9", 99 | "Programming Language :: Python :: 3.10", 100 | "Programming Language :: Python :: 3.11", 101 | "Programming Language :: Python :: 3.12", 102 | "License :: Other/Proprietary License", 103 | 'Intended Audience :: Developers', 104 | "Intended Audience :: Financial and Insurance Industry", 105 | "Intended Audience :: Information Technology", 106 | "Intended Audience :: Science/Research", 107 | "Operating System :: OS Independent", 108 | "Topic :: Office/Business :: Financial :: Investment", 109 | 'Topic :: Software Development :: Libraries :: Python Modules', 110 | ], 111 | ) 112 | -------------------------------------------------------------------------------- /unicorn_binance_local_depth_cache/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | 5 | from .manager import BinanceLocalDepthCacheManager 6 | from .exceptions import * 7 | 8 | -------------------------------------------------------------------------------- /unicorn_binance_local_depth_cache/cluster_endpoints.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | # 5 | # File: unicorn_binance_local_depth_cache/cluster_endpoints.py 6 | # 7 | # Part of ‘UNICORN Binance Local Depth Cache’ 8 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 9 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 10 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 11 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 12 | # LUCIT Online Shop: https://shop.lucit.services/software 13 | # 14 | # License: LSOSL - LUCIT Synergetic Open Source License 15 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 16 | # 17 | # Author: LUCIT Systems and Development 18 | # 19 | # Copyright (c) 2022-2024, LUCIT Systems and Development - https://www.lucit.tech 20 | # All rights reserved. 21 | 22 | class ClusterEndpoints: 23 | create_depthcache: str = "create_depthcache" 24 | create_depthcaches: str = "create_depthcaches" 25 | get_asks: str = "get_asks" 26 | get_bids: str = "get_bids" 27 | get_cluster_info: str = "get_cluster_info" 28 | get_depthcache_list: str = "get_depthcache_list" 29 | get_depthcache_info: str = "get_depthcache_info" 30 | stop_depthcache: str = "stop_depthcache" 31 | submit_license: str = "submit_license" 32 | test: str = "test" 33 | -------------------------------------------------------------------------------- /unicorn_binance_local_depth_cache/exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | # 5 | # File: unicorn_binance_local_depth_cache/exceptions.py 6 | # 7 | # Part of ‘UNICORN Binance Local Depth Cache’ 8 | # Project website: https://www.lucit.tech/unicorn-binance-local-depth-cache.html 9 | # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache 10 | # Documentation: https://unicorn-binance-local-depth-cache.docs.lucit.tech 11 | # PyPI: https://pypi.org/project/unicorn-binance-local-depth-cache 12 | # LUCIT Online Shop: https://shop.lucit.services/software 13 | # 14 | # License: LSOSL - LUCIT Synergetic Open Source License 15 | # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-local-depth-cache/blob/master/LICENSE 16 | # 17 | # Author: LUCIT Systems and Development 18 | # 19 | # Copyright (c) 2022-2024, LUCIT Systems and Development - https://www.lucit.tech 20 | # All rights reserved. 21 | 22 | 23 | class DepthCacheClusterNotReachableError(Exception): 24 | """ 25 | Exception raised when the UBDCC is not reachable. 26 | """ 27 | def __init__(self, url=None): 28 | if url is None: 29 | self.message = f"Connection with UBDCC could not be established!" 30 | else: 31 | self.message = f"Connection with UBDCC ({url}) could not be established!" 32 | super().__init__(self.message) 33 | 34 | 35 | class DepthCacheOutOfSync(Exception): 36 | """ 37 | Exception raised when an attempt is made to use a depth_cache that is out of sync. 38 | """ 39 | def __init__(self, market=None): 40 | if market is None: 41 | self.message = f"The depth_cache is out of sync, please try again later" 42 | else: 43 | self.message = f"The depth_cache for market '{market}' is out of sync, please try again later" 44 | super().__init__(self.message) 45 | 46 | 47 | class DepthCacheAlreadyStopped(Exception): 48 | """ 49 | Exception raised when an attempt is made to use a depth_cache that has already been stopped. 50 | """ 51 | def __init__(self, market=None): 52 | if market is None: 53 | self.message = f"The depth_cache is already stopped!" 54 | else: 55 | self.message = f"The depth_cache for market '{market}' is already stopped!" 56 | super().__init__(self.message) 57 | 58 | 59 | class DepthCacheNotFound(Exception): 60 | """ 61 | Exception raised when an attempt is made to use an instance that does not exist. 62 | """ 63 | def __init__(self, market=None): 64 | if market is None: 65 | self.message = f"The depth_cache does not exist!" 66 | else: 67 | self.message = f"The depth_cache for market '{market}' does not exist!" 68 | super().__init__(self.message) 69 | -------------------------------------------------------------------------------- /unicorn_binance_local_depth_cache/licensing_exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # ¯\_(ツ)_/¯ 4 | # 5 | # File: lucit_licensing_python/licensing_exceptions.py 6 | # 7 | # Project website: https://www.lucit.tech/lucit-licensing-python.html 8 | # Github: https://github.com/LUCIT-Systems-and-Development/lucit-licensing-python 9 | # Documentation: https://lucit-licensing-python.docs.lucit.tech 10 | # PyPI: https://pypi.org/project/lucit-licensing-python 11 | # LUCIT Online Shop: https://shop.lucit.services/software 12 | # 13 | # License: LSOSL - LUCIT Synergetic Open Source License 14 | # https://github.com/LUCIT-Systems-and-Development/lucit-licensing-python/blob/master/LICENSE 15 | # 16 | # Author: LUCIT Systems and Development 17 | # 18 | # Copyright (c) 2022-2024, LUCIT Systems and Development - https://www.lucit.tech 19 | # All rights reserved. 20 | 21 | # define Python user-defined exceptions 22 | class NoValidatedLucitLicense(Exception): 23 | """ 24 | No valid LUCIT license verification. 25 | """ 26 | pass 27 | --------------------------------------------------------------------------------