This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nox | |
import os | |
from pathlib import Path | |
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
VENV_BACKEND = "uv" | |
def ensurepath(): | |
rye_home = os.getenv("RYE_HOME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build stage | |
FROM python:3.12-bookworm AS build | |
RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
ENV PATH="/root/.cargo/bin:$PATH" | |
WORKDIR /app | |
COPY requirements.txt requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Sample of connecting to Socket.IO v2 WebSocket in bitbank with pybotters | |
""" | |
import asyncio | |
import pybotters | |
async def main(): | |
async with pybotters.Client() as client: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import logging | |
from contextlib import AsyncExitStack | |
import websockets | |
logger = logging.getLogger("websockets.client") | |
logger.setLevel(logging.DEBUG) | |
ch = logging.StreamHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generated by datamodel-codegen: | |
# filename: https://github.com/binance/binance-api-swagger/raw/master/spot_api.yaml | |
# timestamp: 2024-01-22T15:18:47+00:00 | |
from __future__ import annotations | |
from typing import List, Optional | |
from pydantic import BaseModel, Field, RootModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import datetime | |
import itertools | |
import pybotters | |
apis = {"bybit_testnet": ["API_KEY", "API_SECRET"]} | |
TESTNET_BASE_URL = "https://api-testnet.bybit.com" | |
TESTNET_PUBLIC_WSURL = "wss://stream-testnet.bybit.com/v5/public/linear" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site_name: "pybotters Docs" | |
nav: | |
- "Introduction": "README.md" | |
- "Usage": | |
- "QuickStart": "Home.md" | |
- "Advanced Usage": "Advanced-Usage.md" | |
- "Guides": | |
- "Exchanges": "Exchanges.md" | |
- "Example": "Example.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import time | |
import httpx | |
async def main(): | |
for use_http2 in (False, True): | |
async with httpx.AsyncClient( | |
base_url="https://api.bitflyer.com", http2=use_http2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import aiohttp | |
from rich.pretty import pprint | |
async def main(): | |
async with aiohttp.ClientSession() as session: | |
async with session.ws_connect( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
r = requests.get( | |
"https://widget.oanda.jp/api/ohlc-rate?instrument=USD_JPY", | |
headers={"x-oanda-widget-api": "ohlc-rate"}, | |
) | |
ohlc = r.json() | |
print(ohlc) |
NewerOlder