forked from knowm/XChange
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'binance-futures' into latest
# Conflicts: # xchange-stream-okex/src/main/java/info/bitrich/xchangestream/okex/OkexStreamingExchange.java
- Loading branch information
Showing
37 changed files
with
1,244 additions
and
356 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
43 changes: 43 additions & 0 deletions
43
xchange-binance/src/main/java/org/knowm/xchange/binance/dto/trade/TrailingFlag.java
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,43 @@ | ||
package org.knowm.xchange.binance.dto.trade; | ||
|
||
import org.knowm.xchange.dto.Order.IOrderFlags; | ||
|
||
/** | ||
* @see <a | ||
* href="https://github.com/binance/binance-spot-api-docs/blob/master/faqs/trailing-stop-faq.md">trailing-stop-faq</a> | ||
* @author mrmx | ||
*/ | ||
public enum TrailingFlag implements IOrderFlags { | ||
/** Trailing of 0.01% */ | ||
P0_01(1), | ||
/** Trailing of 0.1% */ | ||
P0_1(10), | ||
/** Trailing of 1% */ | ||
P1(100), | ||
/** Trailing of 10% */ | ||
P10(1000); | ||
/** Basis Points, also known as BIP or BIPS, are used to indicate a percentage change. */ | ||
private final long trailingBip; | ||
|
||
private TrailingFlag(long trailingBip) { | ||
this.trailingBip = trailingBip; | ||
} | ||
|
||
public long getTrailingBip() { | ||
return trailingBip; | ||
} | ||
|
||
static TrailingFlag of(Number percent) { | ||
switch (percent.toString()) { | ||
case "0.01": | ||
return P0_01; | ||
case "0.1": | ||
return P0_1; | ||
case "1": | ||
return P1; | ||
case "10": | ||
return P10; | ||
} | ||
throw new IllegalArgumentException("Invalid trailing " + percent); | ||
} | ||
} |
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
Oops, something went wrong.