FEATURE: [xfundingv2] strategy state persistence support#2485
Conversation
0dd9f64 to
82895c7
Compare
…JSON marshaling/unmarshaling
1df1029 to
4719b58
Compare
2b95c18 to
3d0a03a
Compare
…haling for TWAPWorker
… for ArbitrageRound and PendingRound
3d0a03a to
9953ce4
Compare
| r.spotWorker.Stop() | ||
| r.futuresWorker.Stop() | ||
| r.syncState.SpotWorker.Stop() | ||
| r.syncState.FuturesWorker.Stop() |
There was a problem hiding this comment.
is there a reason to add SpotWorker and FuturesWorker under the syncState?
You should place them under the ArbitrageRound?
| } | ||
|
|
||
| func (r *ArbitrageRound) retryTransferWorker(ctx context.Context) { | ||
| func (r *ArbitrageRound) retryTransferWorker(ctx context.Context, tickC <-chan time.Time) { |
There was a problem hiding this comment.
maybe not another worker for the transfer, you can do it everytime when the tick is happened??
There was a problem hiding this comment.
Because the transfer API call is blocking and I don't want it to block the main event loop of xfundingv2.
That's why I put the transfer work into dedicated goroutine.
There was a problem hiding this comment.
Especially we are planning to support multiple arbitrage rounds in the future.
I don't want the elapsed time to build up when there are multiple pending rounds.
| "github.com/c9s/bbgo/pkg/types" | ||
| ) | ||
|
|
||
| func (r *ArbitrageRound) LoadStrategy(ctx context.Context, s *Strategy) error { |
There was a problem hiding this comment.
Perhaps call it Initialize(ctx, strategy)
|
|
||
| Symbol string `json:"symbol"` | ||
| SpotWorker *TWAPWorker `json:"spotWorker,omitempty"` | ||
| FuturesWorker *TWAPWorker `json:"futuresWorker,omitempty"` |
There was a problem hiding this comment.
It's state will be serialized.
The underlying general executor will be set by Initialize(ctx, *Strategy).
…c state struct for arbitrage round
strategy state persistence support