:radioactive: This is a personal project, use a your own risk.
lfest-rs is a simulated futures exchange capable of leveraged positions.
You fed it external market data through the MarketUpdate
enum to update the internal state.
Where you either provide bid and ask price or information derived from a candle.
Macros (bba
, candle
) make it easy to construct the concrete variant.
For simplicity's sake (and performance) the exchange does not use an order book.
BaseCurrency
, QuoteCurrency
, Fee
and Leverage
. USD
denoted value into a function that expects a BTC
denoted value. MarketUpdate
type and associated macros. FullTrack
or implement your own using the AccountTracker
trait.The supported order types are:
- Market
: aggressively execute against the best bid / ask
- Limit
: passively place an order into the orderbook
The following performance metrics are available when using the FullTrack
AccountTracker
,
but you may define any performance metric by implementing the AccountTracker
trait.
- win_ratio
: wins / totaltrades
- profit_loss_ratio
: avgwinamnt / avglossamnt
- total_rpnl
: Total realized profit and loss
- sharpe
- sortino
- cumulative fees
: Sum total of fees payed to the exchange
- max_drawdown_wallet_balance
: Maximum fraction the wallet balance has decreased from its high.
- max_drawdown_total
: Drawdown including unrealized profit and loss
- num_trades
: The total number of trades executed
- turnover
: The total quantity executed
- trade_percentage
: trades / totaltradeopportunities
- buy_ratio
: buys / totaltrades
- limit_order_fill_ratio
- limit_order_cancellation_ratio
- historical_value_at_risk
- cornish_fisher_value_at_risk
- d_ratio
Some of these metric may behave differently from what you would expect, so make sure to take a look at the code.
To use this crate in your project, add the following to your Cargo.toml:
[dependencies]
lfest = "0.29.0"
Then proceed to use it in your code. For an example see examples
If you find a bug or would like to help out, feel free to create a pull-request.
I you would like to support the development of this crate, feel free to send over a donation:
Monero (XMR) address:
plain
47xMvxNKsCKMt2owkDuN1Bci2KMiqGrAFCQFSLijWLs49ua67222Wu3LZryyopDVPYgYmAnYkSZSz9ZW2buaDwdyKTWGwwb
Copyright (C) 2020
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/.