Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 57 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@

![Build Status](https://github.com/betcode-org/flumine/actions/workflows/test.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/liampauling/flumine/badge.svg?branch=master)](https://coveralls.io/github/liampauling/flumine?branch=master) [![PyPI version](https://badge.fury.io/py/flumine.svg)](https://pypi.python.org/pypi/flumine) [![Downloads](https://pepy.tech/badge/flumine)](https://pepy.tech/project/flumine)

Betting trading framework with a focus on:
flumine is an open-source, event-based trading framework for sports betting, designed to simplify the development and execution of betting strategies on betting exchanges. flumine provides efficient handling of data streams, risk management, and execution capabilities.

- simplicity
- modular
- pythonic
- rock-solid
- safe
[docs](https://betcode-org.github.io/flumine/)

![Backtesting Analysis](docs/images/jupyterloggingcontrol-screenshot.png?raw=true "Jupyter Logging Control Screenshot")
[join betcode slack group (2k+ members!)](https://join.slack.com/t/betcode-org/shared_invite/zt-2uer9n451-w1QOehxDcG_JXqQfjoMvQA)

Support for market, order and custom streaming data.
## overview

[docs](https://betcode-org.github.io/flumine/)
- Event-based Execution: Real-time execution of trading strategies based on incoming market events
- Custom Strategy Implementation: Easily define and implement trading strategies
- Risk Management: Integrated risk management tools to monitor and limit exposure
- Modular Design: Easily extendable and customizable components
- Simulation: Simulate strategies/execution using historical data
- Paper Trading: Test strategies in a simulated environment before going live
- Data: Support for market, order and custom streaming data
- Exchanges: Betfair, Betdaq (dev) and Betconnect

[join betcode slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-25yz6dt1y-LHya5VzHLOzN3RZEQrSnrA)
![Backtesting Analysis](docs/images/jupyterloggingcontrol-screenshot.png?raw=true "Jupyter Logging Control Screenshot")

Tested on Python 3.8, 3.9, 3.10, 3.11 and 3.12.

Expand All @@ -39,18 +42,38 @@ flumine requires Python 3.8+
Get started...

```python
import betfairlightweight
from flumine import Flumine, clients

trading = betfairlightweight.APIClient("username")
client = clients.BetfairClient(trading)
from flumine import Flumine, BaseStrategy
from betfairlightweight.filters import streaming_market_filter

framework = Flumine(
client=client,
# Define your strategy here
class ExampleStrategy(BaseStrategy):
def check_market_book(self, market, market_book) -> bool:
# process_market_book only executed if this returns True
return True

def process_market_book(self, market, market_book):
# Your strategy logic
pass

# Initialize the framework
framework = Flumine()

# Add your strategy to the framework
framework.add_strategy(
ExampleStrategy(
market_filter=streaming_market_filter(
event_type_ids=["7"],
country_codes=["GB"],
market_types=["WIN"],
)
)
)

# Start the trading framework
framework.run()
```

Example strategy:
Example strategy with logic and order execution:

```python
from flumine import BaseStrategy
Expand All @@ -62,7 +85,7 @@ from betfairlightweight.resources import MarketBook


class ExampleStrategy(BaseStrategy):
def start(self) -> None:
def start(self, flumine) -> None:
print("starting strategy 'ExampleStrategy'")

def check_market_book(self, market: Market, market_book: MarketBook) -> bool:
Expand Down Expand Up @@ -97,24 +120,26 @@ class ExampleStrategy(BaseStrategy):
market.replace_order(order, 1.02) # move


strategy = ExampleStrategy(
market_filter=streaming_market_filter(
event_type_ids=["7"],
country_codes=["GB"],
market_types=["WIN"],
# Initialize the framework
framework = Flumine()

# Add your strategy to the framework
framework.add_strategy(
ExampleStrategy(
market_filter=streaming_market_filter(
event_type_ids=["7"],
country_codes=["GB"],
market_types=["WIN"],
)
)
)

framework.add_strategy(strategy)
```

Run framework:

```python
# Start the trading framework
framework.run()
```

## Features

## features

- Streaming
- Multiple strategies
Expand All @@ -125,7 +150,7 @@ framework.run()
- Event simulation (multi market)
- Middleware and background workers to enable Scores / RaceCard / InPlayService

## Dependencies
## dependencies

flumine relies on these libraries:

Expand Down
2 changes: 1 addition & 1 deletion docs/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Please try the following channels for any support:

- [Betfair Developer Support](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Developer+Support)
- [Slack Group](https://join.slack.com/t/betcode-org/shared_invite/zt-25yz6dt1y-LHya5VzHLOzN3RZEQrSnrA) for any help in using the library
- [Slack Group](https://join.slack.com/t/betcode-org/shared_invite/zt-2uer9n451-w1QOehxDcG_JXqQfjoMvQA) for any help in using the library
- [API Status](https://status.developer.betfair.com/) if things don't seem to be working
32 changes: 11 additions & 21 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@ flūmine
</p>
</div>

Betfair trading framework with a focus on:
flumine is an open-source, event-based trading framework for sports betting, designed to simplify the development and execution of betting strategies on betting exchanges. flumine provides efficient handling of data streams, risk management, and execution capabilities.

- simplicity
- modular
- pythonic
- rock-solid
- safe

Support for market, order and custom streaming data.

[join slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-25yz6dt1y-LHya5VzHLOzN3RZEQrSnrA)
[join betcode slack group (2k+ members!)](https://join.slack.com/t/betcode-org/shared_invite/zt-2uer9n451-w1QOehxDcG_JXqQfjoMvQA)

Tested on Python 3.8, 3.9, 3.10, 3.11 and 3.12.

Expand Down Expand Up @@ -102,20 +94,18 @@ class ExampleStrategy(BaseStrategy):
market.replace_order(order, 1.02) # move


strategy = ExampleStrategy(
market_filter=streaming_market_filter(
event_type_ids=["7"],
country_codes=["GB"],
market_types=["WIN"],
# Add your strategy to the framework
framework.add_strategy(
ExampleStrategy(
market_filter=streaming_market_filter(
event_type_ids=["7"],
country_codes=["GB"],
market_types=["WIN"],
)
)
)

framework.add_strategy(strategy)
```

Run framework:

```python
# Start the trading framework
framework.run()
```

Expand Down
Loading