All Projects → liampauling → flumine

liampauling / flumine

Licence: MIT license
flūmine - Betting trading framework

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to flumine

betting
Fast and flexibly API wrapper for betfair
Stars: ✭ 45 (-49.44%)
Mutual labels:  betfair, betting
web trader
📊 Python Flask game that consolidates data from Nasdaq, allowing the user to practice buying and selling stocks.
Stars: ✭ 21 (-76.4%)
Mutual labels:  trading
crypto-trading-engine
Crypto real-time trading engine
Stars: ✭ 19 (-78.65%)
Mutual labels:  trading
LickHunterPRO
Cryptocurrency Trading Bot that looks for large pools of liquidity getting liquidated on margin trading, when it finds these it counter trades them!
Stars: ✭ 114 (+28.09%)
Mutual labels:  trading
Crypto-Resources
Resources for trading Bitcoin and Altcoins
Stars: ✭ 22 (-75.28%)
Mutual labels:  trading
alpaca-trade-api-cpp
C++ client library for the Alpaca Trading API.
Stars: ✭ 48 (-46.07%)
Mutual labels:  trading
GoatFish-Core
Not production ready - Capital at risk. A Bitcoin leverage trading and backtesting platform that connects to popular Bitcoin exchanges. It is written in JavaScript and runs on Node.js.
Stars: ✭ 31 (-65.17%)
Mutual labels:  trading
go-compound
Golang client for compound.finace api and smart contracts
Stars: ✭ 23 (-74.16%)
Mutual labels:  trading
binance-pump-bot
Automation for Binance p&d(pump and dump) activity, ensures fastest purchase and provides auto selling functionality to lockdown profit during these events.
Stars: ✭ 112 (+25.84%)
Mutual labels:  trading
presso
Event-driven backtest/realtime quantitative trading system.
Stars: ✭ 59 (-33.71%)
Mutual labels:  trading
performance
Collection of documents related tunings for performance of Java low-latency trading systems: from hardware up to application level
Stars: ✭ 65 (-26.97%)
Mutual labels:  trading
onetoken
1Token Demo & Docs
Stars: ✭ 53 (-40.45%)
Mutual labels:  trading
ForEx
Using ML to create a ForEx trader to invest my personal finances to get rid of student debt
Stars: ✭ 17 (-80.9%)
Mutual labels:  trading
tstock
📈A command line tool to view stock charts in the terminal.
Stars: ✭ 498 (+459.55%)
Mutual labels:  trading
coinbase-pro-rs
Coinbase pro client for Rust
Stars: ✭ 127 (+42.7%)
Mutual labels:  trading
Quantrade
Quantitative strategies portfolio index [DEPRECATED].
Stars: ✭ 14 (-84.27%)
Mutual labels:  trading
backtrader template
Basic template for managing Backtrader backtests.
Stars: ✭ 131 (+47.19%)
Mutual labels:  trading
PyTrader
System Trading using Kiwoom OpenAPI+
Stars: ✭ 39 (-56.18%)
Mutual labels:  trading
roq-samples
How to use the Roq C++20 API for Live Cryptocurrency Algorithmic and High-Frequency Trading as well as for Back-Testing and Historical Simulation
Stars: ✭ 119 (+33.71%)
Mutual labels:  trading
go ehlers indicators
A collection of John Ehlers technical analysis indicators / Filters written in pure go, with links to original papers
Stars: ✭ 29 (-67.42%)
Mutual labels:  trading

flūmine

Build Status Coverage Status PyPI version Downloads

Betting trading framework with a focus on:

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

Backtesting Analysis

Support for market, order and custom streaming data.

docs

join betcode slack group

Tested on Python 3.7, 3.8, 3.9 and 3.10.

installation

$ pip install flumine

flumine requires Python 3.7+

setup

Get started...

import betfairlightweight
from flumine import Flumine, clients

trading = betfairlightweight.APIClient("username")
client = clients.BetfairClient(trading)

framework = Flumine(
    client=client,
)

Example strategy:

from flumine import BaseStrategy
from flumine.order.trade import Trade
from flumine.order.order import LimitOrder, OrderStatus
from flumine.markets.market import Market
from betfairlightweight.filters import streaming_market_filter
from betfairlightweight.resources import MarketBook


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

    def check_market_book(self, market: Market, market_book: MarketBook) -> bool:
        # process_market_book only executed if this returns True
        if market_book.status != "CLOSED":
            return True

    def process_market_book(self, market: Market, market_book: MarketBook) -> None:
        # process marketBook object
        for runner in market_book.runners:
            if runner.status == "ACTIVE" and runner.last_price_traded < 1.5:
                trade = Trade(
                    market_id=market_book.market_id, 
                    selection_id=runner.selection_id,
                    handicap=runner.handicap,
                    strategy=self
                )
                order = trade.create_order(
                    side="LAY", 
                    order_type=LimitOrder(price=1.01, size=2.00)
                )
                market.place_order(order)

    def process_orders(self, market: Market, orders: list) -> None:
        for order in orders:
            if order.status == OrderStatus.EXECUTABLE:
                if order.size_remaining == 2.00:
                    market.cancel_order(order, 0.02)  # reduce size to 1.98
                if order.order_type.persistence_type == "LAPSE":
                    market.update_order(order, "PERSIST")
                if order.size_remaining > 0:
                    market.replace_order(order, 1.02)  # move


strategy = ExampleStrategy(
    market_filter=streaming_market_filter(
        event_type_ids=["7"],
        country_codes=["GB"],
        market_types=["WIN"],
    )
)

framework.add_strategy(strategy)

Run framework:

framework.run()

Features

  • Streaming
  • Multiple strategies
  • Multiple clients
  • Order execution
  • Paper trading
  • Simulation
  • Event simulation (multi market)
  • Middleware and background workers to enable Scores / RaceCard / InPlayService

Dependencies

flumine relies on these libraries:

  • betfairlightweight - Betfair API support
  • tenacity - Used for connection retrying (streaming)
  • python-json-logger - JSON logging
  • requests - HTTP support
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].