-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 #4901 from bigscoop/coinex
[coinex] Add market orders
- Loading branch information
Showing
17 changed files
with
452 additions
and
3 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
16 changes: 16 additions & 0 deletions
16
...rc/main/java/org/knowm/xchange/coinex/config/converter/CurrencyPairToStringConverter.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,16 @@ | ||
package org.knowm.xchange.coinex.config.converter; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
import org.knowm.xchange.coinex.CoinexAdapters; | ||
import org.knowm.xchange.currency.CurrencyPair; | ||
|
||
/** | ||
* Converts {@code CurrencyPair} to string | ||
*/ | ||
public class CurrencyPairToStringConverter extends StdConverter<CurrencyPair, String> { | ||
|
||
@Override | ||
public String convert(CurrencyPair value) { | ||
return CoinexAdapters.toString(value); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...x/src/main/java/org/knowm/xchange/coinex/config/converter/OrderTypeToStringConverter.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,22 @@ | ||
package org.knowm.xchange.coinex.config.converter; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
import org.knowm.xchange.dto.Order.OrderType; | ||
|
||
/** | ||
* Converts {@code OrderType} to string | ||
*/ | ||
public class OrderTypeToStringConverter extends StdConverter<OrderType, String> { | ||
|
||
@Override | ||
public String convert(OrderType value) { | ||
switch (value) { | ||
case BID: | ||
return "buy"; | ||
case ASK: | ||
return "sell"; | ||
default: | ||
throw new IllegalArgumentException("Can't map " + value); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...src/main/java/org/knowm/xchange/coinex/config/converter/StringToOrderStatusConverter.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,28 @@ | ||
package org.knowm.xchange.coinex.config.converter; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
import org.knowm.xchange.dto.Order.OrderStatus; | ||
|
||
/** | ||
* Converts string to {@code OrderStatus} | ||
*/ | ||
public class StringToOrderStatusConverter extends StdConverter<String, OrderStatus> { | ||
|
||
@Override | ||
public OrderStatus convert(String value) { | ||
switch (value) { | ||
case "open": | ||
return OrderStatus.OPEN; | ||
case "part_filled": | ||
return OrderStatus.PARTIALLY_FILLED; | ||
case "filled": | ||
return OrderStatus.FILLED; | ||
case "part_canceled": | ||
return OrderStatus.PARTIALLY_CANCELED; | ||
case "canceled": | ||
return OrderStatus.CANCELED; | ||
default: | ||
throw new IllegalArgumentException("Can't map " + value); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...x/src/main/java/org/knowm/xchange/coinex/config/converter/StringToOrderTypeConverter.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,22 @@ | ||
package org.knowm.xchange.coinex.config.converter; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
import org.knowm.xchange.dto.Order.OrderType; | ||
|
||
/** | ||
* Converts string to {@code OrderType} | ||
*/ | ||
public class StringToOrderTypeConverter extends StdConverter<String, OrderType> { | ||
|
||
@Override | ||
public OrderType convert(String value) { | ||
switch (value) { | ||
case "buy": | ||
return OrderType.BID; | ||
case "sell": | ||
return OrderType.ASK; | ||
default: | ||
throw new IllegalArgumentException("Can't map " + value); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
xchange-coinex/src/main/java/org/knowm/xchange/coinex/dto/account/CoinexMarketType.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,14 @@ | ||
package org.knowm.xchange.coinex.dto.account; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum CoinexMarketType { | ||
|
||
SPOT, | ||
MARGIN, | ||
FUTURES; | ||
|
||
} |
Oops, something went wrong.