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

Is it possible to have different costs definition depending on entry or exit #152

Open
tfrojd opened this issue Apr 25, 2024 · 1 comment
Labels
docs Improve documentation question

Comments

@tfrojd
Copy link

tfrojd commented Apr 25, 2024

I am working on a strategy that needs to take position in auction market and scale out of the position in the continous market. Is it possible to have different cost definition for entry and exit in some clever way?

@enzbus enzbus added question docs Improve documentation labels Apr 26, 2024
@enzbus
Copy link
Collaborator

enzbus commented Apr 26, 2024

Hello, yes it can be done. There are 2 types of costs, SimulatorCost used by the market simulator, which implement this interface, and cost objects used in optimization. For those it's a bit trickier since the method called on them at each iteration does not return the cost itself; it updates the value of CVXPY parameters of their expression; it is this method. Both methods receive the current weights of the allocation so they can implement logic to make the cost dependent on your position, whether you're getting in or out. If you derive from SimulatorCost itself it can be possible to define the same object that works both in simulation and optimization, but you should be careful to create different instances to pass to the policy and to the simulator. I'll try to improve the documentation of those, ideally the manual page should explain how custom cost (and costraints, ...) are created.

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

No branches or pull requests

2 participants