repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy | null | null | null | null | 43,374 | null | null | mit | null | null | null | null | null | null | null | examples/contrib/dns_spoofing.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:28.946375 | """
This script makes it possible to use mitmproxy in scenarios where IP spoofing
has been used to redirect connections to mitmproxy. The way this works is that
we rely on either the TLS Server Name Indication (SNI) or the Host header of the
HTTP request. Of course, this is not foolproof - if an HTTPS connection comes
... |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy | null | null | null | null | 43,374 | null | null | mit | null | null | null | null | null | null | null | examples/contrib/domain_fronting.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:28.974037 | import json
from dataclasses import dataclass
from mitmproxy import ctx
from mitmproxy.addonmanager import Loader
from mitmproxy.http import HTTPFlow
"""
This extension implements support for domain fronting.
Usage:
mitmproxy -s examples/contrib/domain_fronting.py --set domainfrontingfile=./domain_fronting.json
... |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy | null | null | null | null | 43,374 | null | null | mit | null | null | null | null | null | null | null | examples/contrib/http_manipulate_cookies.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:29.086975 | """
This script is an example of how to manipulate cookies both outgoing (requests)
and ingoing (responses). In particular, this script inserts a cookie (specified
in a json file) into every request (overwriting any existing cookie of the same
name), and removes cookies from every response that have a certain set of na... |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy | null | null | null | null | 43,374 | null | null | mit | null | null | null | null | null | null | null | examples/contrib/httpdump.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:29.164425 | #!/usr/bin/env python
# dump content to files based on a filter
# usage: mitmdump -s httpdump.py "~ts application/json"
#
# options:
# - dumper_folder: content dump destination folder (default: ./httpdump)
# - open_browser: open integrated browser with proxy configured at start (default: true)
#
# remember to add y... |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy | null | null | null | null | 43,374 | null | null | mit | null | null | null | null | null | null | null | examples/contrib/jsondump.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:29.200449 | """
This script serializes the entire traffic dump, including websocket traffic,
as JSON, and either sends it to a URL or writes to a file. The serialization
format is optimized for Elasticsearch; the script can be used to send all
captured traffic to Elasticsearch directly.
Usage:
mitmproxy
--mode revers... |
mingrammer/diagrams | https://github.com/mingrammer/diagrams | null | null | null | null | 42,237 | null | null | mit | null | null | null | null | null | null | null | diagrams/alibabacloud/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:33.083046 | """
AlibabaCloud provides a set of services for Alibaba Cloud provider.
"""
from diagrams import Node
class _AlibabaCloud(Node):
_provider = "alibabacloud"
_icon_dir = "resources/alibabacloud"
fontcolor = "#ffffff"
class AlibabaCloud(_AlibabaCloud):
_icon = "alibabacloud.png"
|
mingrammer/diagrams | https://github.com/mingrammer/diagrams | null | null | null | null | 42,237 | null | null | mit | null | null | null | null | null | null | null | diagrams/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:33.136621 | import contextvars
import os
import uuid
from pathlib import Path
from typing import Dict, List, Optional, Union
from graphviz import Digraph
# Theme definitions for diagram styling
# Each theme defines: cluster background colors (by depth), border color, edge color
THEMES = {
"neutral": {
"bgcolor": ("#F... |
mingrammer/diagrams | https://github.com/mingrammer/diagrams | null | null | null | null | 42,237 | null | null | mit | null | null | null | null | null | null | null | config.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:33.224271 | # fmt: off
#########################
# Application #
#########################
APP_NAME = "diagrams"
DIR_DOC_ROOT = "docs/nodes"
DIR_APP_ROOT = "diagrams"
DIR_RESOURCE = "resources"
DIR_TEMPLATE = "templates"
PROVIDERS = (
"base",
"onprem",
"aws",
"azure",
"digitalocean",
"gcp",
... |
mingrammer/diagrams | https://github.com/mingrammer/diagrams | null | null | null | null | 42,237 | null | null | mit | null | null | null | null | null | null | null | diagrams/aws/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:33.816468 | """
AWS provides a set of services for Amazon Web Service provider.
"""
from diagrams import Node
class _AWS(Node):
_provider = "aws"
_icon_dir = "resources/aws"
fontcolor = "#ffffff"
class AWS(_AWS):
_icon = "aws.png"
|
mingrammer/diagrams | https://github.com/mingrammer/diagrams | null | null | null | null | 42,237 | null | null | mit | null | null | null | null | null | null | null | diagrams/azure/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:37.137571 | """
Azure provides a set of services for Microsoft Azure provider.
"""
from diagrams import Node
class _Azure(Node):
_provider = "azure"
_icon_dir = "resources/azure"
fontcolor = "#ffffff"
class Azure(_Azure):
_icon = "azure.png"
|
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/bots/py/spot-arbitrage-bot.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.368360 | # -*- coding: utf-8 -*-
import asyncio
import os
from random import randint
import sys
from pprint import pprint
import time
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
print('C... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-futures-watch-order-book.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.369630 | import ccxt.pro
from asyncio import run
async def main():
exchange = ccxt.pro.binance({
'options': {
'defaultType': 'future',
},
})
symbol = 'BTC/USDT'
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
print(orderbook['bids... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/bots/py/bitfinex-lending-bot.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.370923 | # -*- coding: utf-8 -*-
import asyncio
import os
from random import randint
import sys
from pprint import pprint
import time
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(root + '/python')
import ccxt.async_support as ccxt # noqa: E402
print('C... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-spot-and-futures.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.571043 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
orderbooks = {}
def handle_all_orderbooks(orderbooks):
print('We have the following orderbooks:')
for id, orderbooks_by_symbol in orderbooks.items():
for symbol in orderbooks_by_symbol.keys():
orderbook = orderbooks... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-create-order-cancel-order.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.767733 | import ccxt.pro
from pprint import pprint
from asyncio import run
print('CCXT Version:', ccxt.__version__)
async def main():
exchange = ccxt.pro.binance({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
})
markets = await exchange.load_markets()
# exchange.verbose = True # unco... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-fetch-balance-snapshot-watch-balance-updates.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.770973 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import run
print('CCXT Version:', ccxt.__version__)
# This example will run silent and will return your balance only when the balance is updated.
#
# 1. launch the example with your keys and keep it running
# 2. go to the trading section on the website
# 3. plac... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-reload-markets.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.874596 | import ccxt.pro
from asyncio import run, gather
print('CCXT Pro version', ccxt.pro.__version__)
async def watch_order_book(exchange, symbol):
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
datetime = exchange.iso8601(exchange.milliseconds())
prin... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-ohlcv.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.930742 | import ccxt.pro
from asyncio import run
print('CCXT Pro version', ccxt.pro.__version__)
def table(values):
first = values[0]
keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
widths = [max([len(str(v[k])) for v in values]) for k in keys]
string = ' | '.join(['{:<' + str(w... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-many-orderbooks.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.963179 | import ccxt.pro as ccxt
import asyncio
orderbooks = {}
def when_orderbook_changed(exchange_spot, symbol, orderbook):
# this is a common handler function
# it is called when any of the orderbook is updated
# it has access to both the orderbook that was updated
# as well as the rest of the orderbooks
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-margin-balance.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:44.963742 | # -*- coding: utf-8 -*-
from asyncio import run
import ccxt.pro as ccxt
from pprint import pprint
# This example will run silent and will return your balance only when the balance is updated.
# 1. launch the example with your keys and keep it running
# 2. go to the margin trading on the website
# 3. place a margin ... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-futures-watch-balance.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.228540 | import ccxt
import ccxt.pro
import asyncio
from pprint import pprint
loop = asyncio.get_event_loop()
async def print_balance(exchange, market_type):
while True:
try:
balance = await exchange.watch_balance({'type': market_type})
pprint(balance)
print('balance of ' + ma... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-order-book-individual-updates.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.285580 | # -*- coding: utf-8 -*-
from asyncio import run
import ccxt.pro as ccxt
class MyBinance(ccxt.binance):
def handle_order_book_message(self, client, message, orderbook):
asks = self.safe_value(message, 'a', [])
bids = self.safe_value(message, 'b', [])
# printing high-frequency updates is a ... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-futures.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.289222 | import ccxt.pro as ccxt
from asyncio import run
print('CCXT Version:', ccxt.__version__)
async def main():
exchange = ccxt.pro.binance({
'options': {
'defaultType': 'future', # spot, margin, future, delivery
},
})
# or
# exchange = ccxt.pro.binanceusdm()
# or
# exc... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-orders-being-placed.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.397568 | # Python
import ccxt.pro
from asyncio import run, gather
from pprint import pprint
async def place_delayed_order(exchange, symbol, amount, price):
try:
await exchange.sleep(5000) # wait a bit
order = await exchange.create_limit_buy_order(symbol, amount, price)
print(exchange.iso8601(excha... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-spot-futures-balances-continuously.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.402198 | # -*- coding: utf-8 -*-
from asyncio import run, gather
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.pro # noqa: E402
print('CCXT Version:', ccxt.__version__)
async def print_balance_continuously(exchange):... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.466412 | import ccxt.pro
from asyncio import run, gather
data = {
'orderbook': None,
'balance': None,
}
def common_handler(exchange, symbol):
market = exchange.market(symbol)
base = market['base']
quote = market['quote']
balance = data['balance']
orderbook = data['orderbook']
if balance and o... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/bitmex_watch_ohlcv.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.467879 | import ccxt.pro
from asyncio import run
def table(values):
first = values[0]
keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
widths = [max([len(str(v[k])) for v in values]) for k in keys]
string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
return "\n".join([s... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/bitmex_watch_ticker_and_ohlcv.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.506167 | import ccxt.pro
from asyncio import run, gather
def table(values):
first = values[0]
keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
widths = [max([len(str(v[k])) for v in values]) for k in keys]
string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
return "\n"... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/build-ohlcv-many-symbols.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.532733 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro
print('CCXT Version:', ccxt.__version__)
async def loop(exchange, symbol, timeframe, complete_candles_only=False):
duration_in_seconds = exchange.parse_timeframe(timeframe)
duration_in_ms = duration_in_seconds * 1000
while True:
try:
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/bitvavo-watch-order-book.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.597733 | import ccxt.pro
from asyncio import run
print('CCXT Pro version', ccxt.pro.__version__)
async def main():
exchange = ccxt.pro.bitvavo()
await exchange.load_markets()
exchange.verbose = True
symbol = 'BTC/EUR'
while True:
try:
orderbook = await exchange.watch_order_book(symbol... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/coinbase-watch-all-trades.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.803254 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import run
async def main():
exchange = ccxt.pro.coinbase()
method = 'watchTrades'
print('CCXT Pro version', ccxt.pro.__version__)
if exchange.has[method]:
last_id = ''
while True:
try:
trades = await exch... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/consume-all-trades.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.896628 | import ccxt.pro
from asyncio import run
async def consume_all_trades(exchange, symbol):
await exchange.load_markets()
while True:
try:
trades = await exchange.watch_trades(symbol)
print('----------------------------------------------------------------------')
print(... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/coinbase-watch-trades.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.957598 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import run
async def main():
exchange = ccxt.pro.coinbase()
method = 'watchTrades'
print('CCXT Pro version', ccxt.pro.__version__)
if exchange.has[method]:
while True:
try:
trades = await exchange.watch_trades('BT... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/intercept-original-ohlcv-updates.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:45.999540 | # -*- coding: utf-8 -*-
from asyncio import run
import ccxt.pro
from pprint import pprint
class MyBinance(ccxt.pro.binance):
def handle_ohlcv(self, client, message):
# add your handling of the original message here
print('intercepted', message)
return super(MyBinance, self).handle_ohlcv(c... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/gateio-watch-trades.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.000782 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro
from datetime import datetime
async def loop(exchange, symbol):
since = datetime.utcnow()
timestamp = int(since.timestamp() * 1000)
while True:
trades = await exchange.watch_trades(symbol, since=timestamp)
print('---------------------... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-different-streams.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.080458 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, method, symbol):
print('Starting', exchange.id, method, symbol)
while True:
try:
response = await getattr(exchange, method)(symbol)
now = exchange.milliseconds()
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-orderbooks-synchronized.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.112518 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro
orderbooks = {}
def handle_all_orderbooks(orderbooks):
print('We have the following orderbooks:')
for exchange_id, orderbooks_by_symbol in orderbooks.items():
for symbol in orderbooks_by_symbol.keys():
orderbook = orderbooks_by_symb... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-orderbooks-throttled.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.156264 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import run, gather, sleep
orderbooks = {}
def handle_all_orderbooks(orderbooks):
print('We have the following orderbooks:')
for exchange_id, orderbooks_by_symbol in orderbooks.items():
for symbol in orderbooks_by_symbol.keys():
orderb... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-streams-with-keys.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.181337 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, method, symbol):
print('Starting', exchange.id, method, symbol)
while True:
try:
response = await getattr(exchange, method)(symbol)
now = exchange.milliseconds()
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/kucoin-watch-multiple-orderbooks.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.199926 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, symbol):
print('Starting the', exchange.id, 'symbol loop with', symbol)
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
now = exchange.milliseconds()
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-streams.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.408936 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, symbol):
print('Starting the', exchange.id, 'symbol loop with', symbol)
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
now = exchange.milliseconds()
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges-many-symbols-watch-trades.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.506078 | # -*- coding: utf-8 -*-
import ccxt.pro
from asyncio import gather, run
async def symbol_loop(exchange, symbol):
print('Starting the', exchange.id, 'symbol loop with', symbol)
while True:
try:
trades = await exchange.watch_trades(symbol)
now = exchange.milliseconds()
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/many-exchanges.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.538417 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro
async def loop(exchange_id, symbol):
exchange = getattr(ccxt.pro, exchange_id)()
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
now = exchange.milliseconds()
print(exchange.iso8601(now), e... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/okex-create-swap-order.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.565468 | # -*- coding: utf-8 -*-
from asyncio import run
import ccxt.pro
print('CCXT Pro Version: ', ccxt.pro.__version__)
exchange = ccxt.pro.okex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_API_SECRET',
'password': 'YOUR_API_PASSWORD',
'options': { 'defaultType': 'swap' },
})
async def main():
await ... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/multiple-exchanges-watch-orderbook-continuously.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.698549 | import ccxt.pro
import asyncio
import time
async def watch_book(exchange, ticker):
last = None
while True:
try:
orderbook = await exchange.watch_order_book(ticker)
# TODO add timeout within a minute
# TODO add last
top_bid = orderbook['bids'][0][0]
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/okx-bbo-tbt.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.756875 | import ccxt.pro
from asyncio import run
print('CCXT Pro version', ccxt.pro.__version__)
async def main():
exchange = ccxt.pro.okx({
'options': {
'watchOrderBook': {
'depth': 'bbo-tbt', # tick-by-tick best bidask
},
},
})
markets = await exchange.l... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/okex-watch-margin-balance-with-params.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.769803 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro as ccxt
from pprint import pprint
async def main():
exchange = ccxt.pro.okex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
# okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
'password': 'YOUR_... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/on-connected-user-hook.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.771025 | import ccxt.pro
from asyncio import run, ensure_future
from pprint import pprint
print('CCXT Version:', ccxt.__version__)
# on_connected() is called when a client connection is established
# note that the exchange will reuse the same client connection
# some exchanges might require two or more public/private connec... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/okex-watch-margin-balance.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.781942 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro as ccxt
from pprint import pprint
async def main():
exchange = ccxt.pro.okex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
# okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
'password': 'YOUR_... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/one-exchange-different-streams.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.881314 | import ccxt.pro
import asyncio
async def watch_order_book(exchange, symbol):
while True:
orderbook = await exchange.watch_order_book(symbol)
print(orderbook['datetime'], symbol, orderbook['asks'][0], orderbook['bids'][0])
async def watch_trades(exchange, symbol):
while True:
trades =... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/one-exchange-many-streams.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:46.986380 | # -*- coding: utf-8 -*-
from asyncio import run
import ccxt.pro
async def loop(exchange, symbol):
await exchange.throttle(10)
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
now = exchange.milliseconds()
print(exchange.iso8601(now), symbol, orde... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/phemex-cancel-all-orders.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.062390 | import ccxt.pro
from asyncio import run
from pprint import pprint
print('CCXT Version:', ccxt.__version__)
async def main():
exchange = ccxt.pro.phemex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_SECRET',
})
markets = await exchange.load_markets()
# exchange.verbose = True # uncomment... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/watch-all-symbols.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.117795 | # -*- coding: utf-8 -*-
import asyncio
import ccxt.pro
async def loop(exchange, symbol, n):
i = 0
while True:
try:
orderbook = await exchange.watch_order_book(symbol)
# print every 100th bidask to avoid wasting CPU cycles on printing
if not i % 100:
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/spot-vs-future-arbitrage-bitmart.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.198516 | # -*- coding: utf-8 -*-
import asyncio
import sys
import os
# ------------------------------------------------------------------------------
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(root + '/python')
# -------------------------------------... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/watch-custom-exchange-specific-streams.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.296602 | import asyncio
import ccxt.pro
class MyBinance(ccxt.pro.binance):
def handle_mini_ticker(self, client, message):
market_id = self.safe_string_lower(message, 's')
message_hash = market_id + '@miniTicker'
client.resolve(message, message_hash)
def handle_message(self, client, message):
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/watch-many-exchanges-many-tickers.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.362567 | # -*- coding: utf-8 -*-
from asyncio import run, gather
import ccxt.pro
print('CCXT Version:', ccxt.__version__)
async def exchange_loop(exchange_id, symbols):
exchange = getattr(ccxt.pro, exchange_id)()
markets = await exchange.load_markets()
await gather(*[watch_ticker_loop(exchange, symbol) for symb... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/py/all-exchanges.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.363207 | # -*- coding: utf-8 -*-
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
for exchange_id in ccxt.exchanges:
try:
exchan... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/py/aiohttp-custom-session-connector.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.364146 | # pip install aiohttp_socks
import asyncio
import ccxt.async_support as ccxt
import aiohttp
import aiohttp_socks
async def test():
connector = aiohttp_socks.ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080')
session = aiohttp.ClientSession(connector=connector)
exchange = ccxt.binance({
... |
ccxt/ccxt | https://github.com/ccxt/ccxt | null | null | null | null | 42,193 | null | null | mit | null | null | null | null | null | null | null | examples/ccxt.pro/py/watch-ticker-to-csv.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:47.409474 | # -*- coding: utf-8 -*-
from asyncio import gather, run
import ccxt.pro
from pprint import pprint
async def watch_ticker_continuously(exchange, symbol):
filename = exchange.id + '-' + symbol.replace('/', '-') + '.csv'
print('Watching', exchange.id, symbol, filename)
keys = ['index', 'exchange', 'symbol',... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/LightGBM/features_sample.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.195243 | import datetime
import pandas as pd
from qlib.data.inst_processor import InstProcessor
class Resample1minProcessor(InstProcessor):
"""This processor tries to resample the data. It will reasmple the data from 1min freq to day freq by selecting a specific miniute"""
def __init__(self, hour: int, minute: int, ... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/data_formatters/qlib_Alpha158.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.195786 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/expt_settings/configs.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.204891 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/LightGBM/features_resample_N.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.206445 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pandas as pd
from qlib.data.inst_processor import InstProcessor
from qlib.utils.resam import resam_calendar
class ResampleNProcessor(InstProcessor):
def __init__(self, target_frq: str, **kwargs):
self.target_frq = target_f... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/libs/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.212627 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/expt_settings/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.214299 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/data_formatters/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.214814 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/data_formatters/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.216727 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/LightGBM/multi_freq_handler.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.221395 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import pandas as pd
from qlib.data.dataset.loader import QlibDataLoader
from qlib.contrib.data.handler import DataHandlerLP, _DEFAULT_LEARN_PROCESSORS, check_transform_proc
class Avg15minLoader(QlibDataLoader):
def load(self, instruments... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TRA/example.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.839243 | import argparse
import qlib
from ruamel.yaml import YAML
from qlib.utils import init_instance_by_config
def main(seed, config_file="configs/config_alstm.yaml"):
# set random seed
with open(config_file) as f:
yaml = YAML(typ="safe", pure=True)
config = yaml.load(f)
# seed_suffix = "/seed1... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/tft.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.840497 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pathlib import Path
from typing import Union
import numpy as np
import pandas as pd
import tensorflow.compat.v1 as tf
import data_formatters.base
import expt_settings.configs
import libs.hyperparam_opt
import libs.tft_model
import libs.utils... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks_dynamic/DDG-DA/workflow.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.849134 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from pathlib import Path
from typing import Union
import fire
from qlib import auto_init
from qlib.contrib.rolling.ddgda import DDGDA
from qlib.tests.data import GetData
DIRNAME = Path(__file__).absolute().resolve().parent
BENCH_DIR =... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/libs/hyperparam_opt.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.862099 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/libs/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.869785 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks_dynamic/DDG-DA/vis_data.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.901040 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from qlib.utils.pickle_utils import restricted_pickle_load
sns.set(color_codes=True)
plt.rcParams["font.sans-serif"] = "SimHei"
plt.rcParams["axes.unicode_minus"] = False
from tqdm.auto import tqdm
# tqdm.pandas() # for pro... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks_dynamic/baseline/rolling_benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.908760 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from pathlib import Path
from typing import Union
import fire
from qlib import auto_init
from qlib.contrib.rolling.base import Rolling
from qlib.tests.data import GetData
DIRNAME = Path(__file__).absolute().resolve().parent
class Ro... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TRA/src/model.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.912185 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import copy
import math
import json
import collections
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from tqdm import tqdm
from qlib.utils import... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TRA/src/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.923454 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import copy
import torch
import numpy as np
import pandas as pd
from qlib.data.dataset import DatasetH
device = "cuda" if torch.cuda.is_available() else "cpu"
def _to_tensor(x):
if not isinstance(x, torch.Tensor):
return torch.ten... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/benchmarks/TFT/libs/tft_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:50.924561 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/data_demo/data_cache_demo.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.424185 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
The motivation of this demo
- To show the data modules of Qlib is Serializable, users can dump processed data to disk to avoid duplicated data preprocessing
"""
from copy import deepcopy
from pathlib import Path
import pickle
from pprint impo... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/highfreq/highfreq_processor.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.438665 | import numpy as np
import pandas as pd
from qlib.constant import EPS
from qlib.data.dataset.processor import Processor
from qlib.data.dataset.utils import fetch_df_by_index
class HighFreqNorm(Processor):
def __init__(self, fit_start_time, fit_end_time):
self.fit_start_time = fit_start_time
self.fi... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/highfreq/highfreq_ops.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.468192 | import numpy as np
import pandas as pd
import importlib
from qlib.data.ops import ElemOperator, PairOperator
from qlib.config import C
from qlib.data.cache import H
from qlib.data.data import Cal
from qlib.contrib.ops.high_freq import get_calendar_day
class DayLast(ElemOperator):
"""DayLast Operator
Paramete... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/data_demo/data_mem_resuse_demo.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.473370 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
The motivation of this demo
- To show the data modules of Qlib is Serializable, users can dump processed data to disk to avoid duplicated data preprocessing
"""
from copy import deepcopy
from pathlib import Path
import pickle
from pprint impo... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/hyperparameter/LightGBM/hyperparameter_360.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.495609 | import qlib
import optuna
from qlib.constant import REG_CN
from qlib.utils import init_instance_by_config
from qlib.tests.data import GetData
from qlib.tests.config import get_dataset_config, CSI300_MARKET, DATASET_ALPHA360_CLASS
DATASET_CONFIG = get_dataset_config(market=CSI300_MARKET, dataset_class=DATASET_ALPHA360_... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/highfreq/workflow.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.497219 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import fire
import qlib
from qlib.constant import REG_CN
from qlib.config import HIGH_FREQ_CONFIG
from qlib.utils import init_instance_by_config
from qlib.utils.pickle_utils import restricted_pickle_load
from qlib.data.dataset.handler import ... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/highfreq/highfreq_handler.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.536714 | from qlib.data.dataset.handler import DataHandler, DataHandlerLP
from qlib.contrib.data.handler import check_transform_proc
class HighFreqHandler(DataHandlerLP):
def __init__(
self,
instruments="csi300",
start_time=None,
end_time=None,
infer_processors=[],
learn_pro... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/model_rolling/task_manager_rolling.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.538278 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This example shows how a TrainerRM works based on TaskManager with rolling tasks.
After training, how to collect the rolling results will be shown in task_collecting.
Based on the ability of TaskManager, `worker` method offer a simple way for... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/model_interpreter/feature.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.549973 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import qlib
from qlib.constant import REG_CN
from qlib.utils import init_instance_by_config
from qlib.tests.data import GetData
from qlib.tests.config import CSI300_GBDT_TASK
if __name__ == "__main__":
# use default data
provider_uri... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/hyperparameter/LightGBM/hyperparameter_158.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:51.551046 | import qlib
import optuna
from qlib.constant import REG_CN
from qlib.utils import init_instance_by_config
from qlib.tests.config import CSI300_DATASET_CONFIG
from qlib.tests.data import GetData
def objective(trial):
task = {
"model": {
"class": "LGBModel",
"module_path": "qlib.cont... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/nested_decision_execution/workflow.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.094787 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
The expect result of `backtest` is following in current version
'The following are analysis results of benchmark return(1day).'
risk
mean 0.000651
std 0.012472
annualized_return 0.154967
... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/online_srv/update_online_pred.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.095522 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This example shows how OnlineTool works when we need update prediction.
There are two parts including first_train and update_online_pred.
Firstly, we will finish the training and set the trained models to the `online` models.
Next, we ... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/online_srv/online_management_simulate.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.125545 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This example is about how can simulate the OnlineManager based on rolling tasks.
"""
from pprint import pprint
import fire
import qlib
from qlib.model.trainer import DelayTrainerR, DelayTrainerRM, TrainerR, TrainerRM
from qlib.workflow impor... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/portfolio/prepare_riskdata.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.134958 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import numpy as np
import pandas as pd
from qlib.data import D
from qlib.model.riskmodel import StructuredCovEstimator
def prepare_data(riskdata_root="./riskdata", T=240, start_time="2016-01-01"):
universe = D.features(D.instrumen... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/orderbook_data/create_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.234823 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
NOTE:
- This scripts is a demo to import example data import Qlib
- !!!!!!!!!!!!!!!TODO!!!!!!!!!!!!!!!!!!!:
- Its structure is not well designed and very ugly, your contribution is welcome to make importing dataset easier
"""
from datetim... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/online_srv/rolling_online_management.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.257433 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This example shows how OnlineManager works with rolling tasks.
There are four parts including first train, routine 1, add strategy and routine 2.
Firstly, the OnlineManager will finish the first training and set trained models to `online` mod... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/orderbook_data/example.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:53.479264 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from arctic.arctic import Arctic
import qlib
from qlib.data import D
import unittest
class TestClass(unittest.TestCase):
"""
Useful commands
- run all tests: pytest examples/orderbook_data/example.py
- run a single test: pytest... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/rolling_process_data/workflow.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:54.618884 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import qlib
import fire
from datetime import datetime
from qlib.constant import REG_CN
from qlib.data.dataset.handler import DataHandlerLP
from qlib.utils import init_instance_by_config
from qlib.utils.pickle_utils import restricted_pickle_loa... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | examples/rolling_process_data/rolling_handler.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:54.619499 | from qlib.data.dataset.handler import DataHandlerLP
from qlib.data.dataset.loader import DataLoaderDH
from qlib.contrib.data.handler import check_transform_proc
class RollingDataHandler(DataHandlerLP):
def __init__(
self,
start_time=None,
end_time=None,
infer_processors=[],
... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | qlib/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:54.827985 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pathlib import Path
from setuptools_scm import get_version
try:
from ._version import version as __version__
except ImportError:
__version__ = get_version(root="..", relative_to=__file__)
__version__bak = __version__ # This version... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | qlib/backtest/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:54.855404 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
import copy
from pathlib import Path
from typing import TYPE_CHECKING, Any, Generator, List, Optional, Tuple, Union
import pandas as pd
from .account import Account
if TYPE_CHECKING:
from ..strategy.base... |
microsoft/qlib | https://github.com/microsoft/qlib | null | null | null | null | 41,919 | null | null | mit | null | null | null | null | null | null | null | qlib/backtest/account.py | null | null | null | null | null | null | Python | 2026-05-04T02:20:54.863296 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
import copy
from typing import Dict, List, Optional, Tuple, cast
import pandas as pd
from qlib.utils import init_instance_by_config
from .decision import BaseTradeDecision, Order
from .exchange import Exchang... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.