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

Relative Order Size #29

Closed
MarkoPaasila opened this issue Feb 24, 2018 · 5 comments · Fixed by #69
Closed

Relative Order Size #29

MarkoPaasila opened this issue Feb 24, 2018 · 5 comments · Fixed by #69

Comments

@MarkoPaasila
Copy link
Collaborator

MarkoPaasila commented Feb 24, 2018

To be used in the Relative Orders strategy.

In stead of having the order size defined in absolute terms, it should be a percentage of the total balance of the asset in question. The percentage can be set by the user, and 10% can be the default.

The benefits of this are:

  1. Order size will automatically increase with profits - effectively reinvesting them, and without any additional mechanisms
  2. The bot will never completely sell out all of the asset. Order size will decrease as an asset is sold out
  3. The order sizes will always be equal to the asset's proportions in ones account, and attempt to keep them in balance
  4. It's very simple. One parameter and many benefits.
@nikolaybaychenko
Copy link

The way how it could be done is that in Create Bot and Edit Bot windows, there will be a checkbox that defines relative order size that will be checked by default. The amount field that was used for amount of order will be used for percentage of the account's balance only when the Relative Order Size checkbox will be checked.
When it comes to the strategy logic, on initializing of the Relative Orders strategy a boolean value will be defined that takes a value from Relative Order Size checkbox. Later this value will be used in the function that defines an orders amount. If the order amount is relative, calculate order amount based on the percent of the account's balance (e.g. 10% of the balance), where percent of the balance will be taken from the create/edit form's amount field.This function will be executed in update_orders before placing orders or other operations begin, which means it will be ran every time bot creates or updates orders first time or based on some changes in the market.

@MarkoPaasila
Copy link
Collaborator Author

Yes this sounds correct. It should also be noted that order size should not be relative to total account value (as measured in base asset, like USD), but relative to the balance of specific asset which will be allocated to order. For example in the BTS:USD market, if an order is to be placed to sell BTS (buy USD), the order size should be x% of the available BTS. The USD balance can be completely omitted. Same with the opposite side: when placing orders allocating USD (buy BTS), the order size should be a percentage of available USD.

I would like to change the definition slighty. As I just stated, order size should be a percentage of available balance (earlier I said percentage of balance including orders). First, I think it is easier to get available balance. Second, in the future we want to add additional staggered orders to this strategy, and it's better for them to use percentage of available balance than of total balance.

@MarkoPaasila
Copy link
Collaborator Author

Just an additional note: Relative Order Size will result in different order sizes of opposite orders. This is to be expected.

@nikolaybaychenko
Copy link

I think I should note here, about order size based on percentage of available balance. The way how update orders function works now is that it cancels all orders before replacing order on the market. If the order size amount will be calculated after all orders are cancelled, orders will be included in the balance because they are cancelled.

@MarkoPaasila
Copy link
Collaborator Author

Right, so it wouldn't have made any difference in this case.
We can get back to how it works with additional staggered orders when the time comes for that.

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

Successfully merging a pull request may close this issue.

3 participants