-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1271 from c9s/c9s/strategy-convert
REFACTOR: apply market.GreaterThanMinimalOrderQuantity on both convert and xalign
- Loading branch information
Showing
5 changed files
with
158 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package tradingutil | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/c9s/bbgo/pkg/fixedpoint" | ||
"github.com/c9s/bbgo/pkg/types" | ||
) | ||
|
||
var number = fixedpoint.MustNewFromString | ||
|
||
func Test_CollectTradeFee(t *testing.T) { | ||
trades := []types.Trade{ | ||
{ | ||
ID: 1, | ||
Price: number("21000"), | ||
Quantity: number("0.001"), | ||
Symbol: "BTCUSDT", | ||
Side: types.SideTypeBuy, | ||
Fee: number("0.00001"), | ||
FeeCurrency: "BTC", | ||
FeeDiscounted: false, | ||
}, | ||
{ | ||
ID: 2, | ||
Price: number("21200"), | ||
Quantity: number("0.001"), | ||
Symbol: "BTCUSDT", | ||
Side: types.SideTypeBuy, | ||
Fee: number("0.00002"), | ||
FeeCurrency: "BTC", | ||
FeeDiscounted: false, | ||
}, | ||
} | ||
|
||
fees := CollectTradeFee(trades) | ||
assert.NotNil(t, fees) | ||
assert.Equal(t, number("0.00003"), fees["BTC"]) | ||
} |