GithubHelp home page GithubHelp logo

cryptobot's Introduction

pytest

[Preview] pybotters

An advanced api client for python botters.

๐Ÿ“Œ Description

pybottersใฏไปฎๆƒณ้€š่ฒจbotterๅ‘ใ‘ใฎPythonใƒฉใ‚คใƒ–ใƒฉใƒชใงใ™ใ€‚

่ค‡ๆ•ฐๅ–ๅผ•ๆ‰€ใซๅฏพๅฟœใ—ใŸ้žๅŒๆœŸI/OใฎAPIใ‚ฏใƒฉใ‚คใ‚ขใƒณใƒˆใงใ‚ใ‚Šใ€bot้–‹็™บใซใ‚ˆใ‚Š็ด ๆ™ดใ‚‰ใ—ใ„DXใ‚’ๆไพ›ใ—ใพใ™ใ€‚

๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป In development

pybotters ใฏ็พๅœจ ** Previewใƒใƒผใ‚ธใƒงใƒณ ** ใงใ™ใ€‚ ไธ€้ƒจๆฉŸ่ƒฝใฏ้–‹็™บไธญใงใ™ใ€‚

้–‹็™บ็Šถๆณใซใคใ„ใฆใฏ ใ“ใกใ‚‰(Issues) ใ‚’ๅ‚็…งใ—ใฆใใ ใ•ใ„ใ€‚

๐Ÿš€ Features

  • โœจ HTTP / WebSocket Client
    • ่ค‡ๆ•ฐๅ–ๅผ•ๆ‰€ใฎใƒ—ใƒฉใ‚คใƒ™ใƒผใƒˆAPIใ‚’่‡ชๅ‹•่ช่จผ
    • aiohttpใƒฉใ‚คใƒ–ใƒฉใƒชใ‚’ๅŸบ็›คใจใ—ใŸ้žๅŒๆœŸ้€šไฟก
    • WebSocketใฎ่‡ชๅ‹•ๅ†ๆŽฅ็ถšใ€่‡ชๅ‹•ใƒใƒผใƒˆใƒ“ใƒผใƒˆ
  • โœจ DataStore
    • WebSocket็”จใฎ่‡ชๅ‹•ใƒ‡ใƒผใ‚ฟไฟ็ฎกใ‚ฏใƒฉใ‚น
    • ๅ‚็…งๆธกใ—ใซใ‚ˆใ‚‹้ซ˜้€Ÿใชใƒ‡ใƒผใ‚ฟๅ‚็…ง
    • ๅ–ๅผ•ๆ‰€ๅˆฅใƒ‡ใƒผใ‚ฟใƒขใƒ‡ใƒซใฎๅฎŸ่ฃ…
  • โœจ Developer Experience
    • asyncioใƒฉใ‚คใƒ–ใƒฉใƒชใ‚’ๅˆฉ็”จใ—ใŸ้žๅŒๆœŸใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐ
    • ๅž‹ใƒ’ใƒณใƒˆใฎใ‚ตใƒใƒผใƒˆ

๐Ÿฆ Exchanges

Name API auth DataStore API docs
Bybit โœ… โœ… Official
Binance โœ… โœ…(USDโ“ˆ-M) Official
OKX โœ… โœ… Official
Phemex โœ… โœ… Official
Bitget โœ… โœ… Official
MEXC โœ… WIP Official / v3
FTX โœ… โœ… Official
BitMEX โœ… โœ… Official
bitFlyer โœ… โœ… Official
GMO Coin โœ… โœ… Official
Liquid โœ… WIP Official
bitbank โœ… โœ… Official
Coincheck โœ… โœ… Official

๐Ÿ Requires

Python 3.7+

๐Ÿ›  Installation

pip install pybotters

๐Ÿ”ฐ Usage

Single exchange

import asyncio
import pybotters

apis = {
    'bybit': ['BYBIT_API_KEY', 'BYBIT_API_SECRET'],
}

async def main():
    async with pybotters.Client(apis=apis, base_url='https://api.bybit.com') as client:
        # REST API
        resp = await client.get('/v2/private/position/list', params={'symbol': 'BTCUSD'})
        data = await resp.json()
        print(data)

        # WebSocket API (with defautl print handler)
        ws = await client.ws_connect(
            url='wss://stream.bybit.com/realtime',
            send_json={'op': 'subscribe', 'args': ['trade.BTCUSD', 'order', 'position']},
        )
        await ws # Ctrl+C to break

try:
    asyncio.run(main())
except KeyboardInterrupt:
    pass

Multiple exchanges

apis = {
    'bybit': ['BYBIT_API_KEY', 'BYBIT_API_SECRET'],
    'binance': ['BINANCE_API_KEY', 'BINANCE_API_SECRET'],
}

async def main():
    async with pybotters.Client(apis=apis) as client:
        await client.post('https://api.bybit.com/v2/private/order/create', data={'symbol': 'BTCUSD', ...: ...})
        ...
        await client.post('https://dapi.binance.com/dapi/v1/order', data={'symbol': 'BTCUSD_PERP', ...: ...})
        ...

๐Ÿ“– Wiki

่ฉณใ—ใ„ๅˆฉ็”จๆ–นๆณ•ใฏ๐Ÿ‘‰Wikiใƒšใƒผใ‚ธใธ

็พๅœจใ“ใกใ‚‰ใซใซ็งป่กŒไธญใงใ™๐Ÿ‘‰Read the Docs

๐Ÿ—ฝ License

MIT

๐Ÿ’– Author

Twitter: https://twitter.com/MtkN1XBt

Discord: https://discord.com/invite/CxuWSX9U69

cryptobot's People

Contributors

mtkn1 avatar kaznak avatar supermomonga avatar drillan avatar kunmosky1 avatar osaifu-crypto avatar azriel1rf avatar o-matsuo avatar yat1ma30 avatar yota-p avatar

Stargazers

Reinis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.