Skip to main content

arbitragepy - the simple arbitrage calculations package

You can easily calculate arbitrage situation between 2 exchanges.

Doesn't use float in calculations, only Decimal from decimal python standard library package, which guarantees accurate calculations with high precision.

Installation

poetry add arbitragepy

or

pip install arbitragepy

Documentation

Quick Start

from decimal import Decimal

from arbitragepy import (
    arbitrage,
    SymbolInfo,
    OrderInfo,
    OrderPayload,
    ArbitragePayload,
    ArbitrageResult,
)


ask_payload = ArbitragePayload(
    symbol=SymbolInfo(quantity_increment=Decimal("0.01")),
    order=OrderInfo(price=Decimal("10.5"), quantity=Decimal("100.15")),
    balance=Decimal("200"),
    fee=Decimal("0.1")
)
bid_payload = ArbitragePayload(
    symbol=SymbolInfo(quantity_increment=Decimal("0.01")),
    order=OrderInfo(price=Decimal("11.5"), quantity=Decimal("50.3")),
    balance=Decimal("65"),
    fee=Decimal("0.1")
)

result = arbitrage(ask=ask_payload, bid=bid_payload)

assert result == ArbitrageResult(
    ask_order=OrderPayload(
        price=Decimal("10.5"),
        quantity=Decimal("19.02"),
        notional_value=Decimal("199.90971"),
        taken_fee=Decimal("0.19971"),
        fee_in_base_currency=False,
    ),
    bid_order=OrderPayload(
        price=Decimal("11.5"),
        quantity=Decimal("19.02"),
        notional_value=Decimal("218.51127"),
        taken_fee=Decimal("0.21873"),
        fee_in_base_currency=False,
    ),
    spread=Decimal("9.304980733552162123590695000"),
    profit=Decimal("18.60156"),
)

Metadata

Release files for arbitragepy 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arbitragepy 3.0.0
File Size Uploaded
arbitragepy-3.0.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arbitragepy 3.0.0
File Interpreter ABI Platform
arbitragepy-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / arbitragepy-3.0.0.tar.gz

Download URL arbitragepy-3.0.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
133baf68cfaf0b633cffc898a8cbab3348ca29f37f23a5670c3b96a8bb061f98
BLAKE2b-256 checksum
How to use checksums
5d58a245198fc40cc1aaecb165eed6e506daeabb276b1cc0a6d62304dab5be25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0

Release files / arbitragepy-3.0.0-py3-none-any.whl

Download URL arbitragepy-3.0.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c66b867d302ab777626e388725b63da38d2caa8b688e0d6694fb313bf2b41b2
BLAKE2b-256 checksum
How to use checksums
c27e1cdf01067d6ed5522b5d7eab08c9da1294a4b57894e04138cd6cfdbc90dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Darwin/23.1.0

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page