agent0.core.hyperdrive.utilities.predict_trade_test

Test our ability to predict the outcome of a trade.

3 tests are simple demonstrations of how to do a prediction.

Simplest case: test_prediction_example Open long with bonds as input: test_open_long_bonds Open short with base as input: test_open_short_base

4 tests check prediction accuracy, spanning the cases of opening a long/short with bonds/base as inputs.
Open long:

with bonds as input: test_predict_open_long_bonds with base as input: test_predict_open_long_base

Open short:

with bonds as input: test_predict_open_short_bonds with base as input: test_predict_open_short_base

The four prediction tests check: - does our prediction match the input? - predicted delta matches actual delta (for user and pool)

Attributes

YEAR_IN_SECONDS

YEAR_IN_BLOCKS

Functions

test_prediction_example(fast_chain_fixture)

Demonstrate the simplest case of a prediction.

test_open_long_bonds(fast_chain_fixture)

Demonstrate abililty to open long with bonds as input.

test_open_short_base(fast_chain_fixture)

Demonstrate abililty to open short with base as input.

test_predict_open_long_bonds(fast_chain_fixture)

Predict outcome of an open long, for a given amount of bonds.

test_predict_open_long_base(fast_chain_fixture)

Predict outcome of an open long, for a given amount of base.

test_predict_open_short_bonds(fast_chain_fixture)

Predict outcome of an open short, for a given amount of bonds.

test_predict_open_short_base(fast_chain_fixture)

Predict outcome of an open short, for a given amount of base.

Module Contents

agent0.core.hyperdrive.utilities.predict_trade_test.YEAR_IN_SECONDS = 31536000
agent0.core.hyperdrive.utilities.predict_trade_test.YEAR_IN_BLOCKS = 2628000.0
agent0.core.hyperdrive.utilities.predict_trade_test.test_prediction_example(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Demonstrate the simplest case of a prediction.

Output:

Entity

Base

Bonds

Shares

user

100

104.95

100

pool

99.9952

-104.955

99.9952

fee

0.0428367

0.0449786

0.0428367

governance

0.00475964

0.00499762

0.00475964

agent0.core.hyperdrive.utilities.predict_trade_test.test_open_long_bonds(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Demonstrate abililty to open long with bonds as input.

agent0.core.hyperdrive.utilities.predict_trade_test.test_open_short_base(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Demonstrate abililty to open short with base as input.

agent0.core.hyperdrive.utilities.predict_trade_test.test_predict_open_long_bonds(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Predict outcome of an open long, for a given amount of bonds.

agent0.core.hyperdrive.utilities.predict_trade_test.test_predict_open_long_base(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Predict outcome of an open long, for a given amount of base.

agent0.core.hyperdrive.utilities.predict_trade_test.test_predict_open_short_bonds(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Predict outcome of an open short, for a given amount of bonds.

agent0.core.hyperdrive.utilities.predict_trade_test.test_predict_open_short_base(fast_chain_fixture: agent0.core.hyperdrive.interactive.LocalChain)

Predict outcome of an open short, for a given amount of base.