bbgo: Add ClosePosition doc comment

This commit is contained in:
c9s 2022-09-11 02:01:48 +08:00
parent c484c1f176
commit 6c22c3799e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -248,6 +248,9 @@ func (e *GeneralOrderExecutor) GracefulCancel(ctx context.Context) error {
return e.GracefulCancelActiveOrderBook(ctx, e.activeMakerOrders) return e.GracefulCancelActiveOrderBook(ctx, e.activeMakerOrders)
} }
// ClosePosition closes the current position by a percentage.
// percentage 0.1 means close 10% position
// tag is the order tag you want to attach, you may pass multiple tags, the tags will be combined into one tag string by commas.
func (e *GeneralOrderExecutor) ClosePosition(ctx context.Context, percentage fixedpoint.Value, tags ...string) error { func (e *GeneralOrderExecutor) ClosePosition(ctx context.Context, percentage fixedpoint.Value, tags ...string) error {
submitOrder := e.position.NewMarketCloseOrder(percentage) submitOrder := e.position.NewMarketCloseOrder(percentage)
if submitOrder == nil { if submitOrder == nil {