Leveraged Futures Exchange for Simulated Trading (LFEST)
:warning: This is a personal project, use a your own risk.
:warning: The results may not represent real trading results on any given exchange.
This crate aims to be a high performance simulated exchange capable of leveraged positions.
Order Types
The supported order types are:
- market,
- limit
- stop_market
Performance Metrics:
The following performance metrics are available through AccTracker struct:
- total_rpnl
- sharpe
- sharpe_daily_returns
- sortino
- cumulative fees
- sharpe_sterling_ratio
- max_drawdown
- max_upnl_drawdown
- num_trades
- trade_percentage
- buy_ratio
- win_ratio
- turnover
- limit_order_fill_ratio
- limit_order_cancellation_ratio
How to use
To use this crate in your project, add the following to your Cargo.toml:
[dependencies]
lfest = { git = "https://github.com/MathisWellmann/lfest-rs" }
Then proceed to use it in your code. The following example uses a Trade to update the bid and ask price of the exchange.
use ;
use load_trades_from_csv;
use ;
use Instant;
/// analyzer the resulting performance metrics of the traded orders
See the examples folder for more code.
Benchmark
See the example use_trades.rs and compile in release mode to see that the Exchange is capable of simulating 1 million historical trades and executing ~40k market orders in ~470ms.
Dependencies
A non trivial dependency is trade_aggregation as the exchange relies on the Trade and Candle struct.
Contributions
If you find a bug or would like to help out, feel free to create a pull-request.
Donations :moneybag: :money_with_wings:
I you would like to support the development of this crate, feel free to send over a donation:
Monero (XMR) address:
47xMvxNKsCKMt2owkDuN1Bci2KMiqGrAFCQFSLijWLs49ua67222Wu3LZryyopDVPYgYmAnYkSZSz9ZW2buaDwdyKTWGwwb
License
Copyright (C) 2020 <Mathis Wellmann wellmannmathis@gmail.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.