Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test broker with multiple submit twap orders #1103

Closed
Sameep2808 opened this issue Jul 26, 2024 · 3 comments
Closed

Test broker with multiple submit twap orders #1103

Sameep2808 opened this issue Jul 26, 2024 · 3 comments
Assignees

Comments

@Sameep2808
Copy link
Collaborator

Sameep2808 commented Jul 26, 2024

Currently we only test our order submission using only one broker class calling submit twap orders once.

We want to create a test where we have 1 instance of broker and same instance will call submit twap orders twice. Trying to mimic what happens in the production trading

You can refer the test cases present in the below class to understand how to mock and run with one broker and one call to submit twap order function:
https://github.com/kaizen-ai/kaizenflow/blob/master/oms/broker/ccxt/test/test_ccxt_broker.py#L1768

Helper function which creates broker instance and calls 1 iteration of _submit_twap_orders:
https://github.com/kaizen-ai/kaizenflow/blob/master/oms/broker/ccxt/test/mock_exchange_test_case.py#L384

As from the above code you can understand how a broker object is created and _submit_twap_orders is awoked using solipsism loop.

Now just like this we would like to have 2 calls to _submit_twap_orders inorder to test multiple order submission using one broker instance.

The test will go in this file - https://github.com/kaizen-ai/kaizenflow/blob/master/oms/broker/ccxt/test/test_ccxt_broker.py

Lets start with proposing the plan and architecture and then we will move forward with actual testing. Feel free to ask any questions or provide your thoughts into it.

FYI @samarth9008

@samarth9008 samarth9008 changed the title Test dynamic scheduler with multiple submit twap orders Test broker with multiple submit twap orders Jul 26, 2024
@jayati1397
Copy link
Contributor

@samarth9008 can you please update the links, none of them are accessible

@jayati1397
Copy link
Contributor

@samarth9008 I looked into the code
https://github.com/cryptokaizen/cmamp/blob/master/oms/broker/ccxt/test/mock_exchange_test_case.py#L394 has definition for test_submit_twap_orders which is being called by other tests from https://github.com/cryptokaizen/cmamp/blob/master/oms/broker/ccxt/test/test_ccxt_broker.py#L2108

test_submit_twap_orders invokes get_test_broker to create a broker instance and function submit_twap_orders to submit the orders.
So to have just one instance of broker call submit_twap_orders twice we would have to add a test in https://github.com/cryptokaizen/cmamp/blob/master/oms/broker/ccxt/test/mock_exchange_test_case.py that creates one instance of broker and then, in the same test we call submit_twap_orders twice.
We can add a test in class https://github.com/cryptokaizen/cmamp/blob/master/oms/broker/ccxt/test/test_ccxt_broker.py#L2108 where we can call the new test function we created(which calls submit_twap_orders twice)

@samarth9008
Copy link
Collaborator

Okay, lets do a draft PR with some architecture to have a better idea. Seems like going in a right direction.

FYI @Sameep2808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants