├── .gitignore
├── README.md
├── ScreenShots
├── flow.png
├── qrcode.png
└── wechatqr.png
├── pom.xml
└── src
└── main
├── java
└── com
│ ├── okcoin
│ └── commons
│ │ └── okex
│ │ └── open
│ │ └── api
│ │ ├── bean
│ │ ├── account
│ │ │ ├── param
│ │ │ │ ├── Transfer.java
│ │ │ │ └── Withdraw.java
│ │ │ └── result
│ │ │ │ ├── Currency.java
│ │ │ │ ├── Ledger.java
│ │ │ │ ├── Wallet.java
│ │ │ │ └── WithdrawFee.java
│ │ ├── ett
│ │ │ ├── param
│ │ │ │ └── EttCreateOrderParam.java
│ │ │ └── result
│ │ │ │ ├── CursorPager.java
│ │ │ │ ├── EttAccount.java
│ │ │ │ ├── EttCancelOrderResult.java
│ │ │ │ ├── EttConstituents.java
│ │ │ │ ├── EttConstituentsResult.java
│ │ │ │ ├── EttCreateOrderResult.java
│ │ │ │ ├── EttLedger.java
│ │ │ │ ├── EttOrder.java
│ │ │ │ └── EttSettlementDefinePrice.java
│ │ ├── futures
│ │ │ ├── CursorPageParams.java
│ │ │ ├── HttpResult.java
│ │ │ ├── param
│ │ │ │ ├── CancelOrders.java
│ │ │ │ ├── ClosePosition.java
│ │ │ │ ├── Order.java
│ │ │ │ ├── Orders.java
│ │ │ │ └── OrdersItem.java
│ │ │ └── result
│ │ │ │ ├── Book.java
│ │ │ │ ├── Currencies.java
│ │ │ │ ├── EstimatedPrice.java
│ │ │ │ ├── ExchangeRate.java
│ │ │ │ ├── Holds.java
│ │ │ │ ├── Index.java
│ │ │ │ ├── Instruments.java
│ │ │ │ ├── Liquidation.java
│ │ │ │ ├── OrderResult.java
│ │ │ │ ├── PriceLimit.java
│ │ │ │ ├── ServerTime.java
│ │ │ │ ├── Stats.java
│ │ │ │ ├── Ticker.java
│ │ │ │ └── Trades.java
│ │ └── spot
│ │ │ ├── param
│ │ │ ├── LoanRequestDTO.java
│ │ │ ├── MarginConfigRequestDTO.java
│ │ │ ├── Order.java
│ │ │ ├── OrderParamDto.java
│ │ │ ├── PlaceOrderParam.java
│ │ │ ├── RepayRequestDTO.java
│ │ │ └── WithdrawalsParamDTO.java
│ │ │ └── result
│ │ │ ├── Account.java
│ │ │ ├── BatchOrdersResult.java
│ │ │ ├── Book.java
│ │ │ ├── BorrowConfigDto.java
│ │ │ ├── BorrowRequestDto.java
│ │ │ ├── BorrowResult.java
│ │ │ ├── Currency.java
│ │ │ ├── CurrencyDto.java
│ │ │ ├── Fills.java
│ │ │ ├── KlineDto.java
│ │ │ ├── Ledger.java
│ │ │ ├── MarginAccountDetailDto.java
│ │ │ ├── MarginAccountDto.java
│ │ │ ├── MarginBorrowOrderDto.java
│ │ │ ├── OrderInfo.java
│ │ │ ├── OrderResult.java
│ │ │ ├── Product.java
│ │ │ ├── RepaymentRequestDto.java
│ │ │ ├── RepaymentResult.java
│ │ │ ├── ResponseResult.java
│ │ │ ├── ServerTimeDto.java
│ │ │ ├── Ticker.java
│ │ │ ├── Trade.java
│ │ │ └── UserMarginBillDto.java
│ │ ├── client
│ │ ├── APIClient.java
│ │ ├── APICredentials.java
│ │ ├── APIHttpClient.java
│ │ ├── APIRetrofit.java
│ │ └── ApiHttp.java
│ │ ├── config
│ │ └── APIConfiguration.java
│ │ ├── constant
│ │ └── APIConstants.java
│ │ ├── enums
│ │ ├── AlgorithmEnum.java
│ │ ├── CharsetEnum.java
│ │ ├── ContentTypeEnum.java
│ │ ├── FuturesCurrenciesEnum.java
│ │ ├── FuturesTransactionTypeEnum.java
│ │ ├── HttpHeadersEnum.java
│ │ ├── HttpMethodEnum.java
│ │ ├── HttpStatusEnum.java
│ │ └── I18nEnum.java
│ │ ├── exception
│ │ └── APIException.java
│ │ ├── service
│ │ ├── GeneralAPIService.java
│ │ ├── account
│ │ │ ├── AccountAPIService.java
│ │ │ └── impl
│ │ │ │ ├── AccountAPI.java
│ │ │ │ └── AccountAPIServiceImpl.java
│ │ ├── ett
│ │ │ ├── EttAccountAPIService.java
│ │ │ ├── EttOrderAPIService.java
│ │ │ ├── EttProductAPIService.java
│ │ │ └── impl
│ │ │ │ ├── EttAccountAPI.java
│ │ │ │ ├── EttAccountAPIServiceImpl.java
│ │ │ │ ├── EttOrderAPI.java
│ │ │ │ ├── EttOrderAPIServiceImpl.java
│ │ │ │ ├── EttProductAPI.java
│ │ │ │ └── EttProductAPIServiceImpl.java
│ │ ├── futures
│ │ │ ├── FuturesMarketAPIService.java
│ │ │ ├── FuturesTradeAPIService.java
│ │ │ └── impl
│ │ │ │ ├── FuturesMarketAPI.java
│ │ │ │ ├── FuturesMarketAPIServiceImpl.java
│ │ │ │ ├── FuturesTradeAPI.java
│ │ │ │ ├── FuturesTradeAPIServiceImpl.java
│ │ │ │ └── GeneralAPIServiceImpl.java
│ │ └── spot
│ │ │ ├── MarginAccountAPIService.java
│ │ │ ├── MarginOrderAPIService.java
│ │ │ ├── SpotAccountAPIService.java
│ │ │ ├── SpotOrderAPIServive.java
│ │ │ ├── SpotProductAPIService.java
│ │ │ └── impl
│ │ │ ├── MarginAccountAPI.java
│ │ │ ├── MarginAccountAPIServiceImpl.java
│ │ │ ├── MarginOrderAPI.java
│ │ │ ├── MarginOrderAPIServiceImpl.java
│ │ │ ├── SpotAccountAPI.java
│ │ │ ├── SpotAccountAPIServiceImpl.java
│ │ │ ├── SpotOrderAPI.java
│ │ │ ├── SpotOrderApiServiceImpl.java
│ │ │ ├── SpotProductAPI.java
│ │ │ └── SpotProductAPIServiceImpl.java
│ │ └── utils
│ │ ├── DateUtils.java
│ │ ├── HmacSHA256Base64Utils.java
│ │ ├── JsonUtils.java
│ │ ├── NumberUtils.java
│ │ └── OrderIdUtils.java
│ ├── okex
│ └── websocket
│ │ ├── FutureAccount.java
│ │ ├── FutureInstrument.java
│ │ ├── FutureOrder.java
│ │ ├── MD5Util.java
│ │ ├── MoniterTask.java
│ │ ├── OkexConstant.java
│ │ ├── SpotInstrument.java
│ │ ├── WebSocketBase.java
│ │ └── WebSocketClientHandler.java
│ └── xiang
│ ├── controller
│ ├── HedgingController.java
│ ├── UserController.java
│ └── XAuthToken.java
│ ├── po
│ └── User.java
│ ├── service
│ ├── BaseDataService.java
│ ├── DepthService.java
│ ├── FutureAccountService.java
│ ├── FutureInstrumentService.java
│ ├── HedgingDataService.java
│ ├── HedgingService.java
│ ├── Instrument.java
│ ├── InstrumentService.java
│ ├── InstrumentsDepthService.java
│ ├── Level2Service.java
│ ├── SpotInstrumentService.java
│ ├── TradeApiService.java
│ ├── WebSocketService.java
│ └── impl
│ │ ├── AccountConfig.java
│ │ ├── ArrayDepthServiceImpl.java
│ │ ├── BaseDataServiceImpl.java
│ │ ├── Coin.java
│ │ ├── CoinServiceImpl.java
│ │ ├── FinishHedgingServiceImpl.java
│ │ ├── FutureAccountServiceImpl.java
│ │ ├── FutureInstrumentServiceImpl.java
│ │ ├── Hedging.java
│ │ ├── HedgingClient.java
│ │ ├── HedgingConfig.java
│ │ ├── HedgingConfigManager.java
│ │ ├── HedgingContext.java
│ │ ├── HedgingDataServiceImpl.java
│ │ ├── HedgingManager.java
│ │ ├── HedgingServiceImpl.java
│ │ ├── HedgingTrade.java
│ │ ├── HedgingTradeClient.java
│ │ ├── InstrumentServiceImpl.java
│ │ ├── InstrumentsDepth5ServiceImpl.java
│ │ ├── InstrumentsDepthServiceImpl.java
│ │ ├── Level2Bean.java
│ │ ├── LoginServiceImpl.java
│ │ ├── MsgCenterServiceImpl.java
│ │ ├── SpotInstrumentServiceImpl.java
│ │ ├── StartHedgingServiceImpl.java
│ │ ├── StoreServiceImpl.java
│ │ ├── SystemConfig.java
│ │ ├── TradeApiServiceImpl.java
│ │ ├── TradeManager.java
│ │ ├── TradeServiceImpl.java
│ │ ├── TreeDepthServiceImpl.java
│ │ ├── VolumeManager.java
│ │ └── WebSoketClient.java
│ ├── shiro
│ ├── JWTAuth.java
│ ├── JWTCredentialsMatcher.java
│ ├── JWTToken.java
│ ├── JwtAuthFilter.java
│ ├── JwtRealm.java
│ ├── UserFormAuthenticationFilter.java
│ └── UserRealm.java
│ ├── spring
│ ├── APIException.java
│ ├── CorsFilter.java
│ ├── ErrorCodes.java
│ ├── FastJsonConfigExt.java
│ ├── LogExecuteTime.java
│ ├── LogTimeInterceptor.java
│ ├── LoginToken.java
│ ├── LoginTokenArgumentResolver.java
│ ├── Response.java
│ ├── ResponseAdvice.java
│ └── SpringContextHolder.java
│ ├── user
│ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ ├── util
│ └── Constant.java
│ └── vo
│ └── UserVo.java
├── resources
├── development
│ ├── ehcache.xml
│ ├── system.properties
│ └── user.properties
├── log4j2.xml
├── production
│ ├── ehcache.xml
│ ├── system.properties
│ └── user.properties
└── spring
│ ├── spring-context-cache.xml
│ ├── spring-context-config.xml
│ ├── spring-context-shiro.xml
│ └── springmvc.xml
└── webapp
├── WEB-INF
└── web.xml
└── index.jsp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
25 | #maven eclipse project
26 | target/
27 | .project
28 | .classpath
29 | .settings
30 | .metadata
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OkexQuant 期货合约价差套利系统
2 |
3 | #### 项目介绍
4 | 本项目是在Okex平台提供的API v3基础上开发的一套数字货币期货合约套利系统,基本原理是当一个不同期的数字货币合约之间的价差产生异常比率,将进行同时开仓买入和开仓卖出交易,等待合约之间的价差回归正常比率,再进行同时的平仓卖出和平仓买入,从而产生利润。
5 | ##### 项目功能
6 | 1. 支持所有的okex合约币种
7 | 2. 支持多策略同时运行
8 | 3. 实时的合约行情
9 | 4. 不同用户的权限控制
10 |
11 | #### 项目github
12 | 1. 系统总共包括2个项目
13 | 2. [OkexQuant 后端服务 api](https://github.com/liudexiang3218/OkexQuant)
14 | 3. [OkexQuant_vue 前端界面项目](https://github.com/liudexiang3218/OkexQuant_vue)
15 |
16 | #### 软件架构
17 |
18 |
19 |
20 | #### 安装教程
21 |
22 | 1. 安装activeMQ 5的版本,到activeMQ bin目录,执行 activemq start
23 | 2. 下载项目 git clone https://github.com/liudexiang3218/OkexQuant.git
24 | 3. 导入eclipse
25 | 4. 修改配置文件system.properties
26 | 5. jetty:run项目
27 | 6. http://127.0.0.1:8088/index.jsp
28 |
29 | #### 使用说明
30 |
31 | 1. [在线demo](http://47.75.108.228) 香港阿里云服务器
32 | 2. 根据条件设置策略
33 | 3. 开启策略开始按钮
34 |
35 | #### 指数说明
36 |
37 | 1. 当周与次周指数 (当周委托买一价 - 次周委托卖一价 ) / 次周委托卖一价 *100
38 |
39 | #### system.properties配置说明
40 |
41 | 1. ``broker_url ``:activemq连接url
42 | 2. ``ok_websocket_url ``: okex ws连接url
43 | 3. ``ok_rest_url ``: okex api服务器连接
44 | 3. ``ok_api_key ``: 您的okex开发平台上申请的api key
45 | 4. ``ok_secret_key ``: 您的okex开发平台上申请的secret key
46 | 5. ``ok_passphrase ``: 您的okex开发平台上申请的passphrase
47 | 6. ``ok_coins ``: 配置项目支持的数字货币(例如:btc,ltc,eth,etc,btg,xrp,eos)
48 | 6. ``jwt_secret ``: JWT权限加密密钥
49 |
50 | #### user.properties系统用户配置
51 | 1. user=password 账号=密码
52 |
53 | #### 开发环境
54 |
55 | 1. eclipse-2018-12
56 | 2. maven 3.5.4
57 | 3. git
58 | 4. jetty
59 | 5. activeMQ 5.15.9
60 |
61 | #### 技术栈
62 | 1. springmvc 4.3.19
63 | 2. activemq 5.15.4
64 | 3. ehcache 2.10.6
65 | 4. java-jwt 3.4.1
66 | 5. shiro 1.4.0
67 |
68 | #### Donation
69 | If you find Element useful, you can buy us a cup of coffee
70 |
71 |
72 |
73 | #### 作者微信
74 |
75 |
--------------------------------------------------------------------------------
/ScreenShots/flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liudexiang3218/OkexQuant/2e72f9e590c2e268a9ec6157c27565efb5eea83c/ScreenShots/flow.png
--------------------------------------------------------------------------------
/ScreenShots/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liudexiang3218/OkexQuant/2e72f9e590c2e268a9ec6157c27565efb5eea83c/ScreenShots/qrcode.png
--------------------------------------------------------------------------------
/ScreenShots/wechatqr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liudexiang3218/OkexQuant/2e72f9e590c2e268a9ec6157c27565efb5eea83c/ScreenShots/wechatqr.png
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/param/Transfer.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.param;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class Transfer {
6 |
7 | private String currency;
8 |
9 | private BigDecimal amount;
10 |
11 | private Integer from;
12 |
13 | private Integer to;
14 |
15 | private String sub_account;
16 |
17 | private Integer instrument_id;
18 |
19 | public String getCurrency() {
20 | return currency;
21 | }
22 |
23 | public void setCurrency(String currency) {
24 | this.currency = currency;
25 | }
26 |
27 | public BigDecimal getAmount() {
28 | return amount;
29 | }
30 |
31 | public void setAmount(BigDecimal amount) {
32 | this.amount = amount;
33 | }
34 |
35 |
36 | public String getSub_account() {
37 | return sub_account;
38 | }
39 |
40 | public void setSub_account(String sub_account) {
41 | this.sub_account = sub_account;
42 | }
43 |
44 | public Integer getFrom() {
45 | return from;
46 | }
47 |
48 | public void setFrom(Integer from) {
49 | this.from = from;
50 | }
51 |
52 | public Integer getTo() {
53 | return to;
54 | }
55 |
56 | public void setTo(Integer to) {
57 | this.to = to;
58 | }
59 |
60 | public Integer getInstrument_id() {
61 | return instrument_id;
62 | }
63 |
64 | public void setInstrument_id(Integer instrument_id) {
65 | this.instrument_id = instrument_id;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/param/Withdraw.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.param;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class Withdraw {
6 | private BigDecimal amount;
7 |
8 | private String currency;
9 |
10 | private Integer destination;
11 |
12 | private String to_address;
13 |
14 | private String trade_pwd;
15 |
16 | private BigDecimal fee;
17 |
18 | private String tag;
19 |
20 | public BigDecimal getAmount() {
21 | return amount;
22 | }
23 |
24 | public void setAmount(BigDecimal amount) {
25 | this.amount = amount;
26 | }
27 |
28 | public String getCurrency() {
29 | return currency;
30 | }
31 |
32 | public void setCurrency(String currency) {
33 | this.currency = currency;
34 | }
35 |
36 | public String getTrade_pwd() {
37 | return trade_pwd;
38 | }
39 |
40 | public void setTrade_pwd(String trade_pwd) {
41 | this.trade_pwd = trade_pwd;
42 | }
43 |
44 | public BigDecimal getFee() {
45 | return fee;
46 | }
47 |
48 | public void setFee(BigDecimal fee) {
49 | this.fee = fee;
50 | }
51 |
52 | public Integer getDestination() {
53 | return destination;
54 | }
55 |
56 | public void setDestination(Integer destination) {
57 | this.destination = destination;
58 | }
59 |
60 | public String getTo_address() {
61 | return to_address;
62 | }
63 |
64 | public void setTo_address(String to_address) {
65 | this.to_address = to_address;
66 | }
67 |
68 | public String getTag() {
69 | return tag;
70 | }
71 |
72 | public void setTag(String tag) {
73 | this.tag = tag;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/result/Currency.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.result;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class Currency {
6 | private String currency;
7 |
8 | private String name;
9 |
10 | private Integer can_withdraw;
11 |
12 | private Integer can_deposit;
13 |
14 | private BigDecimal min_withdrawal;
15 |
16 | public String getCurrency() {
17 | return currency;
18 | }
19 |
20 | public void setCurrency(String currency) {
21 | this.currency = currency;
22 | }
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name;
30 | }
31 |
32 | public Integer getCan_withdraw() {
33 | return can_withdraw;
34 | }
35 |
36 | public void setCan_withdraw(Integer can_withdraw) {
37 | this.can_withdraw = can_withdraw;
38 | }
39 |
40 | public Integer getCan_deposit() {
41 | return can_deposit;
42 | }
43 |
44 | public void setCan_deposit(Integer can_deposit) {
45 | this.can_deposit = can_deposit;
46 | }
47 |
48 | public BigDecimal getMin_withdrawal() {
49 | return min_withdrawal;
50 | }
51 |
52 | public void setMin_withdrawal(BigDecimal min_withdrawal) {
53 | this.min_withdrawal = min_withdrawal;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/result/Ledger.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.result;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class Ledger {
6 |
7 | private Long ledger_id;
8 |
9 | private String currency;
10 |
11 | private BigDecimal balance;
12 |
13 | private BigDecimal amount;
14 |
15 | private BigDecimal fee;
16 |
17 | private String typeName;
18 |
19 | private String timestamp;
20 |
21 |
22 | public Long getLedger_id() {
23 | return ledger_id;
24 | }
25 |
26 | public void setLedger_id(Long ledger_id) {
27 | this.ledger_id = ledger_id;
28 | }
29 |
30 | public String getCurrency() {
31 | return currency;
32 | }
33 |
34 | public void setCurrency(String currency) {
35 | this.currency = currency;
36 | }
37 |
38 | public BigDecimal getBalance() {
39 | return balance;
40 | }
41 |
42 | public void setBalance(BigDecimal balance) {
43 | this.balance = balance;
44 | }
45 |
46 | public BigDecimal getAmount() {
47 | return amount;
48 | }
49 |
50 | public void setAmount(BigDecimal amount) {
51 | this.amount = amount;
52 | }
53 |
54 | public BigDecimal getFee() {
55 | return fee;
56 | }
57 |
58 | public void setFee(BigDecimal fee) {
59 | this.fee = fee;
60 | }
61 |
62 | public String getTypeName() {
63 | return typeName;
64 | }
65 |
66 | public void setTypeName(String typeName) {
67 | this.typeName = typeName;
68 | }
69 |
70 | public String getTimestamp() {
71 | return timestamp;
72 | }
73 |
74 | public void setTimestamp(String timestamp) {
75 | this.timestamp = timestamp;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/result/Wallet.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.result;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class Wallet {
6 |
7 | private String currency;
8 |
9 | private BigDecimal balance;
10 |
11 | private BigDecimal frozen;
12 |
13 | private BigDecimal available;
14 |
15 | public String getCurrency() {
16 | return currency;
17 | }
18 |
19 | public void setCurrency(String currency) {
20 | this.currency = currency;
21 | }
22 |
23 | public BigDecimal getBalance() {
24 | return balance;
25 | }
26 |
27 | public void setBalance(BigDecimal balance) {
28 | this.balance = balance;
29 | }
30 |
31 | public BigDecimal getFrozen() {
32 | return frozen;
33 | }
34 |
35 | public void setFrozen(BigDecimal frozen) {
36 | this.frozen = frozen;
37 | }
38 |
39 | public BigDecimal getAvailable() {
40 | return available;
41 | }
42 |
43 | public void setAvailable(BigDecimal available) {
44 | this.available = available;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/account/result/WithdrawFee.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.account.result;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public class WithdrawFee {
6 |
7 | private BigDecimal min_fee;
8 |
9 | private BigDecimal max_fee;
10 |
11 |
12 | private String currency;
13 |
14 | public BigDecimal getMin_fee() {
15 | return min_fee;
16 | }
17 |
18 | public void setMin_fee(BigDecimal min_fee) {
19 | this.min_fee = min_fee;
20 | }
21 |
22 | public BigDecimal getMax_fee() {
23 | return max_fee;
24 | }
25 |
26 | public void setMax_fee(BigDecimal max_fee) {
27 | this.max_fee = max_fee;
28 | }
29 |
30 | public String getCurrency() {
31 | return currency;
32 | }
33 |
34 | public void setCurrency(String currency) {
35 | this.currency = currency;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/param/EttCreateOrderParam.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.param;
2 |
3 | import java.math.BigDecimal;
4 |
5 | /**
6 | * @author chuping.cui
7 | * @date 2018/7/5
8 | */
9 | public class EttCreateOrderParam {
10 | private String ett;
11 | private Integer type;
12 | private BigDecimal amount;
13 | private BigDecimal size;
14 | private String clientOid;
15 |
16 | public String getEtt() {
17 | return ett;
18 | }
19 |
20 | public void setEtt(String ett) {
21 | this.ett = ett;
22 | }
23 |
24 | public Integer getType() {
25 | return type;
26 | }
27 |
28 | public void setType(Integer type) {
29 | this.type = type;
30 | }
31 |
32 | public BigDecimal getAmount() {
33 | return amount;
34 | }
35 |
36 | public void setAmount(BigDecimal amount) {
37 | this.amount = amount;
38 | }
39 |
40 | public BigDecimal getSize() {
41 | return size;
42 | }
43 |
44 | public void setSize(BigDecimal size) {
45 | this.size = size;
46 | }
47 |
48 | public String getClientOid() {
49 | return clientOid;
50 | }
51 |
52 | public void setClientOid(String clientOid) {
53 | this.clientOid = clientOid;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/CursorPager.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * @author chuping.cui
7 | * @date 2018/7/5
8 | */
9 | public class CursorPager {
10 |
11 | private List data;
12 | private String before;
13 | private String after;
14 | private int limit;
15 |
16 | public List getData() {
17 | return data;
18 | }
19 |
20 | public void setData(List data) {
21 | this.data = data;
22 | }
23 |
24 | public String getBefore() {
25 | return before;
26 | }
27 |
28 | public void setBefore(String before) {
29 | this.before = before;
30 | }
31 |
32 | public String getAfter() {
33 | return after;
34 | }
35 |
36 | public void setAfter(String after) {
37 | this.after = after;
38 | }
39 |
40 | public int getLimit() {
41 | return limit;
42 | }
43 |
44 | public void setLimit(int limit) {
45 | this.limit = limit;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttAccount.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.util.Objects;
4 |
5 | /**
6 | * @author chuping.cui
7 | * @date 2018/7/4
8 | */
9 | public class EttAccount {
10 |
11 | private String currency;
12 | private String balance;
13 | private String holds;
14 | private String available;
15 |
16 | public String getCurrency() {
17 | return currency;
18 | }
19 |
20 | public void setCurrency(String currency) {
21 | this.currency = currency;
22 | }
23 |
24 | public String getBalance() {
25 | return balance;
26 | }
27 |
28 | public void setBalance(String balance) {
29 | this.balance = balance;
30 | }
31 |
32 | public String getHolds() {
33 | return holds;
34 | }
35 |
36 | public void setHolds(String holds) {
37 | this.holds = holds;
38 | }
39 |
40 | public String getAvailable() {
41 | return available;
42 | }
43 |
44 | public void setAvailable(String available) {
45 | this.available = available;
46 | }
47 |
48 | @Override
49 | public boolean equals(Object o) {
50 | if (this == o) { return true; }
51 | if (o == null || getClass() != o.getClass()) { return false; }
52 | EttAccount that = (EttAccount)o;
53 | return Objects.equals(currency, that.currency) &&
54 | Objects.equals(balance, that.balance) &&
55 | Objects.equals(holds, that.holds) &&
56 | Objects.equals(available, that.available);
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return Objects.hash(currency, balance, holds, available);
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "EttAccount{" +
67 | "currency='" + currency + '\'' +
68 | ", balance='" + balance + '\'' +
69 | ", holds='" + holds + '\'' +
70 | ", available='" + available + '\'' +
71 | '}';
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttCancelOrderResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | /**
4 | * @author chuping.cui
5 | * @date 2018/7/5
6 | */
7 | public class EttCancelOrderResult {
8 | private Boolean result;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttConstituents.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Objects;
5 |
6 | /**
7 | * @author chuping.cui
8 | * @date 2018/7/5
9 | */
10 | public class EttConstituents {
11 |
12 | private String currency;
13 | private BigDecimal amount;
14 |
15 | public String getCurrency() {
16 | return currency;
17 | }
18 |
19 | public void setCurrency(String currency) {
20 | this.currency = currency;
21 | }
22 |
23 | public BigDecimal getAmount() {
24 | return amount;
25 | }
26 |
27 | public void setAmount(BigDecimal amount) {
28 | this.amount = amount;
29 | }
30 |
31 | @Override
32 | public boolean equals(Object o) {
33 | if (this == o) { return true; }
34 | if (o == null || getClass() != o.getClass()) { return false; }
35 | EttConstituents that = (EttConstituents)o;
36 | return Objects.equals(currency, that.currency) &&
37 | Objects.equals(amount, that.amount);
38 | }
39 |
40 | @Override
41 | public int hashCode() {
42 | return Objects.hash(currency, amount);
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return "EttConstituents{" +
48 | "currency='" + currency + '\'' +
49 | ", amount=" + amount +
50 | '}';
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttConstituentsResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.List;
5 | import java.util.Objects;
6 |
7 | /**
8 | * @author chuping.cui
9 | * @date 2018/7/5
10 | */
11 | public class EttConstituentsResult {
12 | private String ett;
13 | private BigDecimal net_value;
14 | private List constituents;
15 |
16 | public String getEtt() {
17 | return ett;
18 | }
19 |
20 | public void setEtt(String ett) {
21 | this.ett = ett;
22 | }
23 |
24 | public BigDecimal getNet_value() {
25 | return net_value;
26 | }
27 |
28 | public void setNet_value(BigDecimal net_value) {
29 | this.net_value = net_value;
30 | }
31 |
32 | public List getConstituents() {
33 | return constituents;
34 | }
35 |
36 | public void setConstituents(List constituents) {
37 | this.constituents = constituents;
38 | }
39 |
40 | @Override
41 | public boolean equals(Object o) {
42 | if (this == o) { return true; }
43 | if (o == null || getClass() != o.getClass()) { return false; }
44 | EttConstituentsResult that = (EttConstituentsResult)o;
45 | return Objects.equals(ett, that.ett) &&
46 | Objects.equals(net_value, that.net_value) &&
47 | Objects.equals(constituents, that.constituents);
48 | }
49 |
50 | @Override
51 | public int hashCode() {
52 | return Objects.hash(ett, net_value, constituents);
53 | }
54 |
55 | @Override
56 | public String toString() {
57 | return "EttConstituentsResult{" +
58 | "ett='" + ett + '\'' +
59 | ", net_value=" + net_value +
60 | ", constituents=" + constituents +
61 | '}';
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttCreateOrderResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.util.Objects;
4 |
5 | /**
6 | * @author chuping.cui
7 | * @date 2018/7/5
8 | */
9 | public class EttCreateOrderResult {
10 |
11 | private String order_id;
12 | private String client_oid;
13 | private Boolean result;
14 |
15 | public String getOrder_id() {
16 | return order_id;
17 | }
18 |
19 | public void setOrder_id(String order_id) {
20 | this.order_id = order_id;
21 | }
22 |
23 | public String getClient_oid() {
24 | return client_oid;
25 | }
26 |
27 | public void setClient_oid(String client_oid) {
28 | this.client_oid = client_oid;
29 | }
30 |
31 | public Boolean getResult() {
32 | return result;
33 | }
34 |
35 | public void setResult(Boolean result) {
36 | this.result = result;
37 | }
38 |
39 | @Override
40 | public boolean equals(Object o) {
41 | if (this == o) { return true; }
42 | if (o == null || getClass() != o.getClass()) { return false; }
43 | EttCreateOrderResult that = (EttCreateOrderResult)o;
44 | return Objects.equals(order_id, that.order_id) &&
45 | Objects.equals(client_oid, that.client_oid) &&
46 | Objects.equals(result, that.result);
47 | }
48 |
49 | @Override
50 | public int hashCode() {
51 | return Objects.hash(order_id, client_oid, result);
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return "EttCreateOrderResult{" +
57 | "order_id='" + order_id + '\'' +
58 | ", client_oid='" + client_oid + '\'' +
59 | ", result=" + result +
60 | '}';
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/ett/result/EttSettlementDefinePrice.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.ett.result;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Objects;
5 |
6 | /**
7 | * @author chuping.cui
8 | * @date 2018/7/5
9 | */
10 | public class EttSettlementDefinePrice {
11 | private String date;
12 | private BigDecimal price;
13 |
14 | public String getDate() {
15 | return date;
16 | }
17 |
18 | public void setDate(String date) {
19 | this.date = date;
20 | }
21 |
22 | public BigDecimal getPrice() {
23 | return price;
24 | }
25 |
26 | public void setPrice(BigDecimal price) {
27 | this.price = price;
28 | }
29 |
30 | @Override
31 | public boolean equals(Object o) {
32 | if (this == o) { return true; }
33 | if (o == null || getClass() != o.getClass()) { return false; }
34 | EttSettlementDefinePrice that = (EttSettlementDefinePrice)o;
35 | return Objects.equals(date, that.date) &&
36 | Objects.equals(price, that.price);
37 | }
38 |
39 | @Override
40 | public int hashCode() {
41 | return Objects.hash(date, price);
42 | }
43 |
44 | @Override
45 | public String toString() {
46 | return "EttSettlementDefinePrice{" +
47 | "date=" + date +
48 | ", price=" + price +
49 | '}';
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/CursorPageParams.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures;
2 |
3 | /**
4 | * Cursor pagination
5 | * Created by Tony Tian on 2018/2/26 19:55.
6 | */
7 | public class CursorPageParams {
8 | /**
9 | * Request page before (newer) this pagination id.
10 | * eg: before=2, page number = 1.
11 | */
12 | protected int before;
13 | /**
14 | * Request page after (older) this pagination id.
15 | * eg: after=2, page number = 3.
16 | */
17 | protected int after;
18 | /**
19 | * Number of results per request. Maximum 100. (default 100)
20 | */
21 | protected int limit;
22 |
23 | public int getBefore() {
24 | return before;
25 | }
26 |
27 | public void setBefore(int before) {
28 | this.before = before;
29 | }
30 |
31 | public int getAfter() {
32 | return after;
33 | }
34 |
35 | public void setAfter(int after) {
36 | this.after = after;
37 | }
38 |
39 | public int getLimit() {
40 | return limit;
41 | }
42 |
43 | public void setLimit(int limit) {
44 | this.limit = limit;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/HttpResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures;
2 |
3 | /**
4 | * Http Result
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 17/03/2018 11:36
9 | */
10 | public class HttpResult {
11 |
12 | private int code;
13 | private String message;
14 |
15 | public int getCode() {
16 | return code;
17 | }
18 |
19 | public void setCode(int code) {
20 | this.code = code;
21 | }
22 |
23 | public String getMessage() {
24 | return message;
25 | }
26 |
27 | public void setMessage(String message) {
28 | this.message = message;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/param/CancelOrders.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.param;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Close Position
7 | *
8 | * @author wc.j
9 | * @version 1.0.0
10 | * @date 2018/10/19 16:54
11 | */
12 | public class CancelOrders {
13 |
14 | public List getOrder_ids() {
15 | return order_ids;
16 | }
17 |
18 | public void setOrder_ids(List order_ids) {
19 | this.order_ids = order_ids;
20 | }
21 |
22 | List order_ids;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/param/ClosePosition.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.param;
2 |
3 | /**
4 | * Close Position
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/9 15:38
9 | */
10 | public class ClosePosition {
11 | /**
12 | * The id of the futures, eg: BTC_USD_0331
13 | */
14 | private String instrument_id;
15 | /**
16 | * The execution type {@link com.okcoin.commons.okex.open.api.enums.FuturesTransactionTypeEnum}
17 | */
18 | private Integer type;
19 |
20 | public String getInstrument_id() {
21 | return instrument_id;
22 | }
23 |
24 | public void setInstrument_id(String instrument_id) {
25 | this.instrument_id = instrument_id;
26 | }
27 |
28 | public Integer getType() {
29 | return type;
30 | }
31 |
32 | public void setType(Integer type) {
33 | this.type = type;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/param/Order.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.param;
2 |
3 | /**
4 | * New Order
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/9 15:38
9 | */
10 | public class Order {
11 | /**
12 | * The id of the futures, eg: BTC-USD-180629
13 | */
14 | protected String instrument_id;
15 | /**
16 | * lever, default 10.
17 | */
18 | protected Double leverage;
19 | /**
20 | * You setting order id.(optional)
21 | */
22 | private String client_oid;
23 | /**
24 | * The execution type {@link com.okcoin.commons.okex.open.api.enums.FuturesTransactionTypeEnum}
25 | */
26 | private Integer type;
27 | /**
28 | * The order price: Maximum 1 million
29 | */
30 | private Double price;
31 | /**
32 | * The order amount: Maximum 1 million
33 | */
34 | private Integer size;
35 | /**
36 | * Match best counter party price (BBO)? 0: No 1: Yes If yes, the 'price' field is ignored
37 | */
38 | private Integer match_price;
39 |
40 | public String getInstrument_id() {
41 | return instrument_id;
42 | }
43 |
44 | public void setinstrument_id(String instrument_id) {
45 | this.instrument_id = instrument_id;
46 | }
47 |
48 |
49 | public String getClient_oid() {
50 | return client_oid;
51 | }
52 |
53 | public void setClient_oid(String client_oid) {
54 | this.client_oid = client_oid;
55 | }
56 | public Double getLeverage() {
57 | return leverage;
58 | }
59 |
60 | public void setLeverage(Double leverage) {
61 | this.leverage = leverage;
62 | }
63 |
64 | public Integer getType() {
65 | return type;
66 | }
67 |
68 | public void setType(Integer type) {
69 | this.type = type;
70 | }
71 |
72 | public Double getPrice() {
73 | return price;
74 | }
75 |
76 | public void setPrice(Double price) {
77 | this.price = price;
78 | }
79 |
80 | public Integer getSize() {
81 | return size;
82 | }
83 |
84 | public void setSize(Integer size) {
85 | this.size = size;
86 | }
87 |
88 | public Integer getMatch_price() {
89 | return match_price;
90 | }
91 |
92 | public void setMatch_price(Integer match_price) {
93 | this.match_price = match_price;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/param/Orders.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.param;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * New Order
7 | *
8 | * @author Tony Tian
9 | * @version 1.0.0
10 | * @date 2018/3/9 15:38
11 | */
12 | public class Orders {
13 | /**
14 | * The id of the futures, eg: BTC-USD-180629
15 | */
16 | protected String instrument_id;
17 |
18 |
19 | /**
20 | * lever, default 10.
21 | */
22 | protected Double leverage;
23 |
24 | /**
25 | * batch new order sub element
26 | */
27 | List orders_data;
28 |
29 | public String getInstrument_id() {
30 | return instrument_id;
31 | }
32 |
33 | public void setinstrument_id(String instrument_id) {
34 | this.instrument_id = instrument_id;
35 | }
36 |
37 | public Double getLeverage() {
38 | return leverage;
39 | }
40 |
41 | public void setLeverage(Double leverage) {
42 | this.leverage = leverage;
43 | }
44 |
45 | public List getOrders_data() {
46 | return orders_data;
47 | }
48 |
49 | public void setOrders_data(List orders_data) {
50 | this.orders_data = orders_data;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/param/OrdersItem.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.param;
2 |
3 | /**
4 | * batch new order sub element
5 | * Created by Tony Tian on 2018/2/28 17:57.
6 | */
7 | public class OrdersItem {
8 | /**
9 | * You setting order id. (optional)
10 | */
11 | private String client_oid;
12 | /**
13 | * The execution type {@link com.okcoin.commons.okex.open.api.enums.FuturesTransactionTypeEnum}
14 | */
15 | private Integer type;
16 | /**
17 | * The order price: Maximum 1 million
18 | */
19 | private Double price;
20 | /**
21 | * The order amount: Maximum 1 million
22 | */
23 | private Integer size;
24 | /**
25 | * Match best counter party price (BBO)? 0: No 1: Yes If yes, the 'price' field is ignored
26 | */
27 | private Integer match_price;
28 |
29 | public String getClient_oid() {
30 | return client_oid;
31 | }
32 |
33 | public void setClient_oid(String client_oid) {
34 | this.client_oid = client_oid;
35 | }
36 |
37 | public Integer getType() {
38 | return type;
39 | }
40 |
41 | public void setType(Integer type) {
42 | this.type = type;
43 | }
44 |
45 | public Double getPrice() {
46 | return price;
47 | }
48 |
49 | public void setPrice(Double price) {
50 | this.price = price;
51 | }
52 |
53 | public Integer getSize() {
54 | return size;
55 | }
56 |
57 | public void setSize(Integer size) {
58 | this.size = size;
59 | }
60 |
61 | public Integer getMatch_price() {
62 | return match_price;
63 | }
64 |
65 | public void setMatch_price(Integer match_price) {
66 | this.match_price = match_price;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Book.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | import com.alibaba.fastjson.JSONArray;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * futures contract product book
9 | *
10 | * @author Tony Tian
11 | * @version 1.0.0
12 | * @date 2018/3/12 15:14
13 | */
14 | public class Book {
15 |
16 | /**
17 | * asks book
18 | */
19 | JSONArray asks;
20 | /**
21 | * bids book
22 | */
23 | JSONArray bids;
24 | /**
25 | * time
26 | */
27 | String timestamp;
28 |
29 | public JSONArray getAsks() { return asks; }
30 |
31 | public void setAsks(JSONArray asks) { this.asks = asks; }
32 |
33 | public JSONArray getBids() { return bids; }
34 |
35 | public void setBids(JSONArray bids) { this.bids = bids; }
36 |
37 | public String getTimestamp() { return timestamp; }
38 |
39 | public void setTimestamp(String timestamp) { this.timestamp = timestamp; }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Currencies.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Contract currency
5 | * Created by Tony Tian on 2018/2/26 21:33.
6 | */
7 | public class Currencies {
8 | /**
9 | * symbol
10 | */
11 | private Integer id;
12 | /**
13 | * currency name
14 | */
15 | private String name;
16 | /**
17 | * Minimum transaction quantity
18 | */
19 | private Double min_size;
20 |
21 | public Integer getId() {
22 | return id;
23 | }
24 |
25 | public void setId(Integer id) {
26 | this.id = id;
27 | }
28 |
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | public Double getMin_size() {
38 | return min_size;
39 | }
40 |
41 | public void setMin_size(Double min_size) {
42 | this.min_size = min_size;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/EstimatedPrice.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Contract price estimate for delivery.
5 | * Created by Tony Tian on 2018/2/26 15:52.
6 | */
7 | public class EstimatedPrice {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * Estimated price
14 | */
15 | private Double settlement_price;
16 | /**
17 | * time
18 | */
19 | private String timestamp;
20 |
21 | public String getTimestamp() {
22 | return timestamp;
23 | }
24 |
25 | public void setTimestamp(String timestamp) {
26 | this.timestamp = timestamp;
27 | }
28 |
29 | public String getInstrument_id() { return instrument_id; }
30 |
31 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
32 |
33 | public Double getSettlement_price() { return settlement_price; }
34 |
35 | public void setSettlement_price(Double settlement_price) { this.settlement_price = settlement_price; }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/ExchangeRate.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Exchange Rate
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/9 18:31
9 | */
10 | public class ExchangeRate {
11 | /**
12 | * legal tender pairs
13 | */
14 | private String product_id;
15 | /**
16 | * exchange rate
17 | */
18 | private Double rate;
19 |
20 | public String getProduct_id() {
21 | return product_id;
22 | }
23 |
24 | public void setProduct_id(String product_id) {
25 | this.product_id = product_id;
26 | }
27 |
28 | public Double getRate() {
29 | return rate;
30 | }
31 |
32 | public void setRate(Double rate) {
33 | this.rate = rate;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Holds.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * All of contract position
5 | * Created by Tony Tian on 2018/2/26 16:14.
6 | */
7 | public class Holds {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * all of position
14 | */
15 | private Integer amount;
16 |
17 | private String timestamp;
18 |
19 | public String getInstrument_id() { return instrument_id; }
20 |
21 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
22 |
23 | public Integer getAmount() {
24 | return amount;
25 | }
26 |
27 | public void setAmount(Integer amount) {
28 | this.amount = amount;
29 | }
30 |
31 | public String getTimestamp() {
32 | return timestamp;
33 | }
34 |
35 | public void setTimestamp(String timestamp) {
36 | this.timestamp = timestamp;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Index.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * The index of futures contract product information
5 | * Created by Tony Tian on 2018/3/1 18:36.
6 | */
7 | public class Index {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * index
14 | */
15 | private Double index = 0.00D;
16 | /**
17 | * time
18 | */
19 | private String timestamp;
20 |
21 | public String getInstrument_id() { return instrument_id; }
22 |
23 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
24 |
25 | public Double getIndex() { return index; }
26 |
27 | public void setIndex(Double index) { this.index = index; }
28 |
29 | public String getTimestamp() {
30 | return timestamp;
31 | }
32 |
33 | public void setTimestamp(String timestamp) {
34 | this.timestamp = timestamp;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Instruments.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * futures contract products
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/2/26 10:49
9 | */
10 | public class Instruments {
11 | /**
12 | * The id of the futures contract
13 | */
14 | private String instrument_id;
15 | /**
16 | * Currency
17 | */
18 | private String underlying_index;
19 | /**
20 | * Quote currency
21 | */
22 | private String quote_currency;
23 | /**
24 | * Minimum amount: $
25 | */
26 | private Double tick_size;
27 | /**
28 | * Unit price per contract
29 | */
30 | private Double contract_val;
31 | /**
32 | * Effect of time
33 | */
34 | private String listing;
35 | /**
36 | * Settlement price
37 | */
38 | private String delivery;
39 | /**
40 | * Minimum amount: cont
41 | */
42 | private Double trade_increment;
43 |
44 | public String getInstrument_id() { return instrument_id; }
45 |
46 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
47 |
48 |
49 | public String getQuote_currency() {
50 | return quote_currency;
51 | }
52 |
53 | public void setQuote_currency(String quote_currency) {
54 | this.quote_currency = quote_currency;
55 | }
56 |
57 | public Double getTick_size() { return tick_size; }
58 |
59 | public void setTick_size(Double tick_size) { this.tick_size = tick_size; }
60 |
61 | public Double getContract_val() {
62 | return contract_val;
63 | }
64 |
65 | public void setContract_val(Double contract_val) {
66 | this.contract_val = contract_val;
67 | }
68 |
69 | public String getListing() {
70 | return listing;
71 | }
72 |
73 | public void setListing(String listing) {
74 | this.listing = listing;
75 | }
76 |
77 | public String getDelivery() {
78 | return delivery;
79 | }
80 |
81 | public void setDelivery(String delivery) {
82 | this.delivery = delivery;
83 | }
84 |
85 | public Double getTrade_increment() {
86 | return trade_increment;
87 | }
88 |
89 | public void setTrade_increment(Double trade_increment) {
90 | this.trade_increment = trade_increment;
91 | }
92 |
93 | public String getUnderlying_index() { return underlying_index; }
94 |
95 | public void setUnderlying_index(String underlying_index) { this.underlying_index = underlying_index; }
96 | }
97 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Liquidation.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * all of contract liquidation
5 | * Created by Tony Tian on 2018/2/26 16:36.
6 | */
7 | public class Liquidation {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * order price
14 | */
15 | private Double price;
16 | /**
17 | * order quantity(unit: contract)
18 | */
19 | private Double size;
20 | /**
21 | * The execution type {@link com.okcoin.commons.okex.open.api.enums.FuturesTransactionTypeEnum}
22 | */
23 | private Integer type;
24 | /**
25 | * user loss due to forced liquidation
26 | */
27 | private Double loss;
28 | /**
29 | * create date
30 | */
31 | private String created_at;
32 |
33 | public Double getPrice() {
34 | return price;
35 | }
36 |
37 | public void setPrice(Double price) {
38 | this.price = price;
39 | }
40 |
41 | public Integer getType() {
42 | return type;
43 | }
44 |
45 | public void setType(Integer type) {
46 | this.type = type;
47 | }
48 |
49 | public Double getLoss() {
50 | return loss;
51 | }
52 |
53 | public void setLoss(Double loss) {
54 | this.loss = loss;
55 | }
56 |
57 | public String getInstrument_id() { return instrument_id; }
58 |
59 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
60 |
61 | public Double getSize() { return size; }
62 |
63 | public void setSize(Double size) { this.size = size; }
64 | public String getCreated_at() { return created_at; }
65 |
66 | public void setCreated_at(String created_at) { this.created_at = created_at; }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/OrderResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * New Order Result
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/9 15:56
9 | */
10 | public class OrderResult {
11 | /**
12 | * You setting order id.
13 | */
14 | private String client_oid;
15 | /**
16 | * The order id provided by OKEx.
17 | */
18 | private String order_id;
19 | /**
20 | * The Server processing results: true: successful, false: failure.
21 | */
22 | private boolean result;
23 |
24 | private int error_code;
25 | private String error_message;
26 |
27 | public String getClient_oid() {
28 | return client_oid;
29 | }
30 |
31 | public void setClient_oid(String client_oid) {
32 | this.client_oid = client_oid;
33 | }
34 |
35 | public String getOrder_id() {
36 | return order_id;
37 | }
38 |
39 | public void setOrder_id(String order_id) {
40 | this.order_id = order_id;
41 | }
42 |
43 | public boolean isResult() {
44 | return result;
45 | }
46 |
47 | public void setResult(boolean result) {
48 | this.result = result;
49 | }
50 |
51 | public int getError_code() {
52 | return error_code;
53 | }
54 |
55 | public void setError_code(int error_code) {
56 | this.error_code = error_code;
57 | }
58 |
59 | public String getError_messsage() {
60 | return error_message;
61 | }
62 |
63 | public void setError_messsage(String error_messsage) {
64 | this.error_message = error_messsage;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/PriceLimit.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * The current limit of the contract.
5 | * Created by Tony Tian on 2018/2/26 16:21.
6 | */
7 | public class PriceLimit {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * Highest price
14 | */
15 | private Double highest;
16 | /**
17 | * Lowest price
18 | */
19 | private Double lowest;
20 |
21 | private String timestamp;
22 |
23 | public String getInstrument_id() {
24 | return instrument_id;
25 | }
26 |
27 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
28 |
29 | public String getTimestamp() { return timestamp; }
30 |
31 | public void setTimestamp(String timestamp) { this.timestamp = timestamp; }
32 |
33 | public Double getHighest() { return highest; }
34 |
35 | public void setHighest(Double highest) { this.highest = highest; }
36 |
37 | public Double getLowest() { return lowest; }
38 |
39 | public void setLowest(Double lowest) { this.lowest = lowest; }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/ServerTime.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Time of the server running OKEX's REST API.
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/8 20:58
9 | */
10 | public class ServerTime {
11 | private String iso;
12 | private String epoch;
13 |
14 | public String getIso() {
15 | return iso;
16 | }
17 |
18 | public void setIso(String iso) {
19 | this.iso = iso;
20 | }
21 |
22 | public String getEpoch() {
23 | return epoch;
24 | }
25 |
26 | public void setEpoch(String epoch) {
27 | this.epoch = epoch;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Stats.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Get 24 hours of contract data.
5 | * Created by Tony Tian on 2018/2/26 13:59.
6 | */
7 | public class Stats {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String product_id;
12 | /**
13 | * Opening price
14 | */
15 | private Double open;
16 | /**
17 | * 24 hours of highest price
18 | */
19 | private Double high;
20 | /**
21 | * 24 hours of lowest price
22 | */
23 | private Double low;
24 | /**
25 | * Volume of sheet
26 | */
27 | private Double volume;
28 |
29 | public String getProduct_id() {
30 | return product_id;
31 | }
32 |
33 | public void setProduct_id(String product_id) {
34 | this.product_id = product_id;
35 | }
36 |
37 | public Double getOpen() {
38 | return open;
39 | }
40 |
41 | public void setOpen(Double open) {
42 | this.open = open;
43 | }
44 |
45 | public Double getHigh() {
46 | return high;
47 | }
48 |
49 | public void setHigh(Double high) {
50 | this.high = high;
51 | }
52 |
53 | public Double getLow() {
54 | return low;
55 | }
56 |
57 | public void setLow(Double low) {
58 | this.low = low;
59 | }
60 |
61 | public Double getVolume() {
62 | return volume;
63 | }
64 |
65 | public void setVolume(Double volume) {
66 | this.volume = volume;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Ticker.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * The latest data on the futures contract product
5 | * Created by Tony Tian on 2018/2/26 13;16.
6 | */
7 | public class Ticker {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String instrument_id;
12 | /**
13 | * Buy first price
14 | */
15 | private Double best_bid;
16 | /**
17 | * Sell first price
18 | */
19 | private Double best_ask;
20 | /**
21 | * Highest price
22 | */
23 | private Double high_24h;
24 | /**
25 | * Lowest price
26 | */
27 | private Double low_24h;
28 | /**
29 | * Latest price
30 | */
31 | private Double last;
32 | /**
33 | * Volume (recent 24 hours)
34 | */
35 | private Double volume_24h;
36 | /**
37 | * timestamp
38 | */
39 | private String timestamp;
40 |
41 | public String getInstrument_id() { return instrument_id; }
42 |
43 | public void setInstrument_id(String instrument_id) { this.instrument_id = instrument_id; }
44 |
45 | public Double getBest_bid() {
46 | return best_bid;
47 | }
48 |
49 | public void setBest_bid(Double best_bid) {
50 | this.best_bid = best_bid;
51 | }
52 |
53 | public Double getBest_ask() {
54 | return best_ask;
55 | }
56 |
57 | public void setBest_ask(Double best_ask) {
58 | this.best_ask = best_ask;
59 | }
60 |
61 | public Double getHigh_24h() {
62 | return high_24h;
63 | }
64 |
65 | public void setHigh_24h(Double high_24h) {
66 | this.high_24h = high_24h;
67 | }
68 |
69 | public Double getLow_24h() {
70 | return low_24h;
71 | }
72 |
73 | public void setLow_24h(Double low_24h) {
74 | this.low_24h = low_24h;
75 | }
76 |
77 | public Double getLast() {
78 | return last;
79 | }
80 |
81 | public void setLast(Double last) {
82 | this.last = last;
83 | }
84 |
85 | public Double getVolume_24h() {
86 | return volume_24h;
87 | }
88 |
89 | public void setVolume_24h(Double volume_24h) {
90 | this.volume_24h = volume_24h;
91 | }
92 |
93 | public String getTimestamp() {
94 | return timestamp;
95 | }
96 |
97 | public void setTimestamp(String timestamp) {
98 | this.timestamp = timestamp;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/futures/result/Trades.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.futures.result;
2 |
3 | /**
4 | * Get the latest transaction log information.
5 | * Created by Tony Tian on 2018/2/26 13:30.
6 | */
7 | public class Trades {
8 | /**
9 | * The id of the futures contract
10 | */
11 | private String trade_id;
12 | /**
13 | * Transaction type
14 | */
15 | private String side;
16 | /**
17 | * Transaction price
18 | */
19 | private Double price;
20 | /**
21 | * Transaction amount
22 | */
23 | private Double qty;
24 | /**
25 | * Transaction date
26 | */
27 | private String timestamp;
28 |
29 |
30 |
31 | public String getTrade_id() { return trade_id; }
32 |
33 | public void setTrade_id(String trade_id) { this.trade_id = trade_id; }
34 |
35 | public String getSide() { return side; }
36 |
37 | public void setSide(String side) { this.side = side; }
38 |
39 |
40 | public Double getPrice() {
41 | return price;
42 | }
43 |
44 | public void setPrice(Double price) {
45 | this.price = price;
46 | }
47 |
48 | public Double getQty() {
49 | return qty;
50 | }
51 |
52 | public void setQty(Double qty) {
53 | this.qty = qty;
54 | }
55 |
56 | public String getTimestamp() { return timestamp; }
57 |
58 | public void setTimestamp(String timestamp) { this.timestamp = timestamp; }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/LoanRequestDTO.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class LoanRequestDTO {
4 | private Integer productId;
5 | private Integer currencyId;
6 | private String amount;
7 |
8 | public Integer getProductId() {
9 | return this.productId;
10 | }
11 |
12 | public void setProductId(final Integer productId) {
13 | this.productId = productId;
14 | }
15 |
16 | public Integer getCurrencyId() {
17 | return this.currencyId;
18 | }
19 |
20 | public void setCurrencyId(final Integer currencyId) {
21 | this.currencyId = currencyId;
22 | }
23 |
24 | public String getAmount() {
25 | return this.amount;
26 | }
27 |
28 | public void setAmount(final String amount) {
29 | this.amount = amount;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/MarginConfigRequestDTO.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class MarginConfigRequestDTO {
4 | private Integer status;
5 |
6 | public Integer getStatus() {
7 | return this.status;
8 | }
9 |
10 | public void setStatus(final Integer status) {
11 | this.status = status;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/Order.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class Order {
4 |
5 | private String product_id;
6 |
7 | private String side;
8 |
9 | private String type;
10 |
11 | private String size;
12 |
13 | private String price;
14 |
15 | private String funds;
16 |
17 | private String client_oid;
18 |
19 | public String getClient_oid() {
20 | return client_oid;
21 | }
22 |
23 | public void setClient_oid(String client_oid) {
24 | this.client_oid = client_oid;
25 | }
26 |
27 | public String getProduct_id() {
28 | return product_id;
29 | }
30 |
31 | public void setProduct_id(String product_id) {
32 | this.product_id = product_id;
33 | }
34 |
35 | public String getSide() {
36 | return side;
37 | }
38 |
39 | public void setSide(String side) {
40 | this.side = side;
41 | }
42 |
43 | public String getType() {
44 | return type;
45 | }
46 |
47 | public void setType(String type) {
48 | this.type = type;
49 | }
50 |
51 | public String getSize() {
52 | return size;
53 | }
54 |
55 | public void setSize(String size) {
56 | this.size = size;
57 | }
58 |
59 | public String getPrice() {
60 | return price;
61 | }
62 |
63 | public void setPrice(String price) {
64 | this.price = price;
65 | }
66 |
67 | public String getFunds() {
68 | return funds;
69 | }
70 |
71 | public void setFunds(String funds) {
72 | this.funds = funds;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/OrderParamDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | import java.util.List;
4 |
5 | public class OrderParamDto {
6 | private String instrument_id;
7 | private List order_ids;
8 |
9 | public String getInstrument_id() {
10 | return this.instrument_id;
11 | }
12 |
13 | public void setInstrument_id(final String instrument_id) {
14 | this.instrument_id = instrument_id;
15 | }
16 |
17 |
18 | public List getOrder_ids() {
19 | return this.order_ids;
20 | }
21 |
22 | public void setOrder_ids(final List order_ids) {
23 | this.order_ids = order_ids;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/PlaceOrderParam.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class PlaceOrderParam {
4 | /**
5 | * 客户端下单 标示id 非必填
6 | */
7 | private String client_oid;
8 | /**
9 | * 币对如 etc_eth
10 | */
11 | private String instrument_id;
12 | /**
13 | * 买卖类型 buy/sell
14 | */
15 | private String side;
16 | /**
17 | * 订单类型 限价单 limit 市价单 market
18 | */
19 | private String type;
20 | /**
21 | * 交易数量
22 | */
23 | private String size;
24 | /**
25 | * 限价单使用 价格
26 | */
27 | private String price;
28 | /**
29 | * 市价单使用 价格
30 | */
31 | private String notional;
32 |
33 | /**
34 | * 来源(web app ios android)
35 | */
36 | private Byte source = 0;
37 |
38 | /**
39 | * 1币币交易 2杠杆交易
40 | */
41 | private Byte margin_trading;
42 |
43 | public String getClient_oid() {
44 | return this.client_oid;
45 | }
46 |
47 | public void setClient_oid(final String client_oid) {
48 | this.client_oid = client_oid;
49 | }
50 |
51 |
52 | public String getInstrument_id() {
53 | return this.instrument_id;
54 | }
55 |
56 | public void setInstrument_id(final String instrument_id) {
57 | this.instrument_id = instrument_id;
58 | }
59 |
60 | public String getSide() {
61 | return this.side;
62 | }
63 |
64 | public void setSide(final String side) {
65 | this.side = side;
66 | }
67 |
68 | public String getType() {
69 | return this.type;
70 | }
71 |
72 | public void setType(final String type) {
73 | this.type = type;
74 | }
75 |
76 | public String getSize() {
77 | return this.size;
78 | }
79 |
80 | public void setSize(final String size) {
81 | this.size = size;
82 | }
83 |
84 | public String getPrice() {
85 | return this.price;
86 | }
87 |
88 | public void setPrice(final String price) {
89 | this.price = price;
90 | }
91 |
92 |
93 | public String getNotional() {
94 | return this.notional;
95 | }
96 |
97 | public void setNotional(final String notional) {
98 | this.notional = notional;
99 | }
100 |
101 | public Byte getSource() {
102 | return this.source;
103 | }
104 |
105 | public void setSource(final Byte source) {
106 | this.source = source;
107 | }
108 |
109 |
110 | public Byte getMargin_trading() {
111 | return this.margin_trading;
112 | }
113 |
114 | public void setMargin_trading(final Byte margin_trading) {
115 | this.margin_trading = margin_trading;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/RepayRequestDTO.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class RepayRequestDTO {
4 | private Integer productId;
5 | private Integer currencyId;
6 | private String amount;
7 | private Long orderId;
8 |
9 | public Integer getProductId() {
10 | return this.productId;
11 | }
12 |
13 | public void setProductId(final Integer productId) {
14 | this.productId = productId;
15 | }
16 |
17 | public Integer getCurrencyId() {
18 | return this.currencyId;
19 | }
20 |
21 | public void setCurrencyId(final Integer currencyId) {
22 | this.currencyId = currencyId;
23 | }
24 |
25 | public String getAmount() {
26 | return this.amount;
27 | }
28 |
29 | public void setAmount(final String amount) {
30 | this.amount = amount;
31 | }
32 |
33 | public Long getOrderId() {
34 | return this.orderId;
35 | }
36 |
37 | public void setOrderId(final Long orderId) {
38 | this.orderId = orderId;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/param/WithdrawalsParamDTO.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.param;
2 |
3 | public class WithdrawalsParamDTO {
4 | }
5 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Account.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class Account {
4 |
5 | private String id;
6 | private String currency;
7 | private String balance;
8 | private String available;
9 | private String hold;
10 |
11 | public String getHold() {
12 | return this.hold;
13 | }
14 |
15 | public void setHold(final String hold) {
16 | this.hold = hold;
17 | }
18 |
19 | public String getId() {
20 | return this.id;
21 | }
22 |
23 | public void setId(final String id) {
24 | this.id = id;
25 | }
26 |
27 | public String getCurrency() {
28 | return this.currency;
29 | }
30 |
31 | public void setCurrency(final String currency) {
32 | this.currency = currency;
33 | }
34 |
35 | public String getBalance() {
36 | return this.balance;
37 | }
38 |
39 | public void setBalance(final String balance) {
40 | this.balance = balance;
41 | }
42 |
43 | public String getAvailable() {
44 | return this.available;
45 | }
46 |
47 | public void setAvailable(final String available) {
48 | this.available = available;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/BatchOrdersResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | import java.util.List;
4 |
5 | public class BatchOrdersResult {
6 |
7 | private boolean result;
8 | private List order_id;
9 | private String client_oid;
10 |
11 | public boolean isResult() {
12 | return this.result;
13 | }
14 |
15 | public void setResult(final boolean result) {
16 | this.result = result;
17 | }
18 |
19 | public List getOrder_id() {
20 | return this.order_id;
21 | }
22 |
23 | public void setOrder_id(final List order_id) {
24 | this.order_id = order_id;
25 | }
26 |
27 | public String getClient_oid() {
28 | return this.client_oid;
29 | }
30 |
31 | public void setClient_oid(final String client_oid) {
32 | this.client_oid = client_oid;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Book.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | import java.util.List;
4 |
5 | public class Book {
6 | private List asks;
7 |
8 | private List bids;
9 |
10 | public List getAsks() {
11 | return asks;
12 | }
13 |
14 | public void setAsks(List asks) {
15 | this.asks = asks;
16 | }
17 |
18 | public List getBids() {
19 | return bids;
20 | }
21 |
22 | public void setBids(List bids) {
23 | this.bids = bids;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/BorrowConfigDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class BorrowConfigDto {
4 | private String product_id;
5 | private String currency;
6 | private String available;
7 | private String rate;
8 | private String leverage_ratio;
9 |
10 | public String getProduct_id() {
11 | return this.product_id;
12 | }
13 |
14 | public void setProduct_id(final String product_id) {
15 | this.product_id = product_id;
16 | }
17 |
18 | public String getCurrency() {
19 | return this.currency;
20 | }
21 |
22 | public void setCurrency(final String currency) {
23 | this.currency = currency;
24 | }
25 |
26 | public String getAvailable() {
27 | return this.available;
28 | }
29 |
30 | public void setAvailable(final String available) {
31 | this.available = available;
32 | }
33 |
34 | public String getRate() {
35 | return this.rate;
36 | }
37 |
38 | public void setRate(final String rate) {
39 | this.rate = rate;
40 | }
41 |
42 | public String getLeverage_ratio() {
43 | return this.leverage_ratio;
44 | }
45 |
46 | public void setLeverage_ratio(final String leverage_ratio) {
47 | this.leverage_ratio = leverage_ratio;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/BorrowRequestDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class BorrowRequestDto {
4 | private String instrument_id;
5 | private String currency;
6 | private String amount;
7 |
8 | public String getInstrument_id() {
9 | return this.instrument_id;
10 | }
11 |
12 | public void setInstrument_id(final String instrument_id) {
13 | this.instrument_id = instrument_id;
14 | }
15 |
16 | public String getCurrency() {
17 | return this.currency;
18 | }
19 |
20 | public void setCurrency(final String currency) {
21 | this.currency = currency;
22 | }
23 |
24 | public String getAmount() {
25 | return this.amount;
26 | }
27 |
28 | public void setAmount(final String amount) {
29 | this.amount = amount;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/BorrowResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 |
4 | public class BorrowResult {
5 |
6 | private boolean result;
7 | private Long borrow_id;
8 |
9 | public boolean isResult() {
10 | return this.result;
11 | }
12 |
13 | public void setResult(final boolean result) {
14 | this.result = result;
15 | }
16 |
17 | public Long getBorrow_id() {
18 | return this.borrow_id;
19 | }
20 |
21 | public void setBorrow_id(final Long borrow_id) {
22 | this.borrow_id = borrow_id;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Currency.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class Currency {
4 | private String currency_id;
5 | private String name;
6 |
7 | public String getCurrency_id() {
8 | return this.currency_id;
9 | }
10 |
11 | public void setCurrency_id(final String currency_id) {
12 | this.currency_id = currency_id;
13 | }
14 |
15 | public String getName() {
16 | return this.name;
17 | }
18 |
19 | public void setName(final String name) {
20 | this.name = name;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/CurrencyDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class CurrencyDto {
4 | private String currency_id;
5 | private String name;
6 |
7 | public String getCurrency_id() {
8 | return this.currency_id;
9 | }
10 |
11 | public void setCurrency_id(final String currency_id) {
12 | this.currency_id = currency_id;
13 | }
14 |
15 | public String getName() {
16 | return this.name;
17 | }
18 |
19 | public void setName(final String name) {
20 | this.name = name;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/KlineDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class KlineDto {
4 | private String time;
5 | private String low;
6 | private String high;
7 | private String open;
8 | private String close;
9 | private String volume;
10 |
11 | public String getTime() {
12 | return this.time;
13 | }
14 |
15 | public void setTime(final String time) {
16 | this.time = time;
17 | }
18 |
19 | public String getLow() {
20 | return this.low;
21 | }
22 |
23 | public void setLow(final String low) {
24 | this.low = low;
25 | }
26 |
27 | public String getHigh() {
28 | return this.high;
29 | }
30 |
31 | public void setHigh(final String high) {
32 | this.high = high;
33 | }
34 |
35 | public String getOpen() {
36 | return this.open;
37 | }
38 |
39 | public void setOpen(final String open) {
40 | this.open = open;
41 | }
42 |
43 | public String getClose() {
44 | return this.close;
45 | }
46 |
47 | public void setClose(final String close) {
48 | this.close = close;
49 | }
50 |
51 | public String getVolume() {
52 | return this.volume;
53 | }
54 |
55 | public void setVolume(final String volume) {
56 | this.volume = volume;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Ledger.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class Ledger {
4 |
5 | private Long ledger_id;
6 | private String currency;
7 | private String amount;
8 | private String balance;
9 | private String type;
10 | private Details details;
11 | private String timestamp;
12 |
13 | public Long getLedger_id() {
14 | return this.ledger_id;
15 | }
16 |
17 | public void setLedger_id(final Long ledger_id) {
18 | this.ledger_id = ledger_id;
19 | }
20 |
21 |
22 |
23 | public String getCurrency() {
24 | return this.currency;
25 | }
26 |
27 | public void setCurrency(final String currency) {
28 | this.currency = currency;
29 | }
30 |
31 | public String getAmount() {
32 | return this.amount;
33 | }
34 |
35 | public void setAmount(final String amount) {
36 | this.amount = amount;
37 | }
38 |
39 | public String getBalance() {
40 | return this.balance;
41 | }
42 |
43 | public void setBalance(final String balance) {
44 | this.balance = balance;
45 | }
46 |
47 | public String getType() {
48 | return this.type;
49 | }
50 |
51 | public void setType(final String type) {
52 | this.type = type;
53 | }
54 |
55 | public Details getDetails() {
56 | return this.details;
57 | }
58 |
59 | public void setDetails(final Details details) {
60 | this.details = details;
61 | }
62 |
63 | public String getTimestamp() {
64 | return this.timestamp;
65 | }
66 |
67 | public void setTimestamp(final String timestamp) {
68 | this.timestamp = timestamp;
69 | }
70 |
71 | public static class Details {
72 | private Long order_id;
73 | private String instrument_id;
74 |
75 | public Long getOrder_id() {
76 | return this.order_id;
77 | }
78 |
79 | public void setOrder_id(final Long order_id) {
80 | this.order_id = order_id;
81 | }
82 |
83 | public String getInstrument_id() {
84 | return this.instrument_id;
85 | }
86 |
87 | public void setInstrument_id(final String instrument_id) {
88 | this.instrument_id = instrument_id;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/MarginAccountDetailDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class MarginAccountDetailDto {
4 | private String balance;
5 | private String available;
6 | private String holds;
7 |
8 | public String getBalance() {
9 | return this.balance;
10 | }
11 |
12 | public void setBalance(final String balance) {
13 | this.balance = balance;
14 | }
15 |
16 | public String getAvailable() {
17 | return this.available;
18 | }
19 |
20 | public void setAvailable(final String available) {
21 | this.available = available;
22 | }
23 |
24 | public String getHolds() {
25 | return this.holds;
26 | }
27 |
28 | public void setHolds(final String holds) {
29 | this.holds = holds;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/MarginAccountDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | import java.util.List;
4 |
5 | public class MarginAccountDto {
6 | private String product_id;
7 | private List detailDtos;
8 |
9 | public String getProduct_id() {
10 | return this.product_id;
11 | }
12 |
13 | public void setProduct_id(final String product_id) {
14 | this.product_id = product_id;
15 | }
16 |
17 | public List getDetailDtos() {
18 | return this.detailDtos;
19 | }
20 |
21 | public void setDetailDtos(final List detailDtos) {
22 | this.detailDtos = detailDtos;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/OrderResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class OrderResult {
4 |
5 | private boolean result;
6 | private Long order_id;
7 | private String client_oid;
8 |
9 | public String getClient_oid() {
10 | return this.client_oid;
11 | }
12 |
13 | public void setClient_oid(final String client_oid) {
14 | this.client_oid = client_oid;
15 | }
16 |
17 | public boolean isResult() {
18 | return this.result;
19 | }
20 |
21 | public void setResult(final boolean result) {
22 | this.result = result;
23 | }
24 |
25 | public Long getOrder_id() {
26 | return this.order_id;
27 | }
28 |
29 | public void setOrder_id(final Long order_id) {
30 | this.order_id = order_id;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Product.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class Product {
4 |
5 | private String product_id;
6 | private String base_currency;
7 | private String quote_currency;
8 | private String min_size;
9 | private String size_increment;
10 | private String tick_size;
11 |
12 | private String base_min_size;
13 | private String base_increment;
14 | private String quote_increment;
15 | private String instrument_id;
16 |
17 | public String getInstrument_id() {
18 | return this.instrument_id;
19 | }
20 |
21 | public void setInstrument_id(final String instrument_id) {
22 | this.instrument_id = instrument_id;
23 | }
24 |
25 | public String getMin_size() {
26 | return this.min_size;
27 | }
28 |
29 | public void setMin_size(final String min_size) {
30 | this.min_size = min_size;
31 | }
32 |
33 | public String getSize_increment() {
34 | return this.size_increment;
35 | }
36 |
37 | public void setSize_increment(final String size_increment) {
38 | this.size_increment = size_increment;
39 | }
40 |
41 | public String getTick_size() {
42 | return this.tick_size;
43 | }
44 |
45 | public void setTick_size(final String tick_size) {
46 | this.tick_size = tick_size;
47 | }
48 |
49 | public String getBase_increment() {
50 | return this.base_increment;
51 | }
52 |
53 | public void setBase_increment(final String base_increment) {
54 | this.base_increment = base_increment;
55 | }
56 |
57 | public String getProduct_id() {
58 | return this.product_id;
59 | }
60 |
61 | public void setProduct_id(final String product_id) {
62 | this.product_id = product_id;
63 | }
64 |
65 | public String getBase_currency() {
66 | return this.base_currency;
67 | }
68 |
69 | public void setBase_currency(final String base_currency) {
70 | this.base_currency = base_currency;
71 | }
72 |
73 | public String getQuote_currency() {
74 | return this.quote_currency;
75 | }
76 |
77 | public void setQuote_currency(final String quote_currency) {
78 | this.quote_currency = quote_currency;
79 | }
80 |
81 | public String getBase_min_size() {
82 | return this.base_min_size;
83 | }
84 |
85 | public void setBase_min_size(final String base_min_size) {
86 | this.base_min_size = base_min_size;
87 | }
88 |
89 |
90 |
91 | public String getQuote_increment() {
92 | return this.quote_increment;
93 | }
94 |
95 | public void setQuote_increment(final String quote_increment) {
96 | this.quote_increment = quote_increment;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/RepaymentRequestDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class RepaymentRequestDto {
4 | private String instrument_id;
5 | private String currency;
6 | private String amount;
7 | private String borrow_id;
8 |
9 | public String getInstrument_id() {
10 | return this.instrument_id;
11 | }
12 |
13 | public void setInstrument_id(final String instrument_id) {
14 | this.instrument_id = instrument_id;
15 | }
16 |
17 | public String getCurrency() {
18 | return this.currency;
19 | }
20 |
21 | public void setCurrency(final String currency) {
22 | this.currency = currency;
23 | }
24 |
25 | public String getAmount() {
26 | return this.amount;
27 | }
28 |
29 | public void setAmount(final String amount) {
30 | this.amount = amount;
31 | }
32 |
33 | public String getBorrow_id() {
34 | return this.borrow_id;
35 | }
36 |
37 | public void setBorrow_id(final String borrow_id) {
38 | this.borrow_id = borrow_id;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/RepaymentResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 |
4 | public class RepaymentResult {
5 |
6 | private boolean result;
7 | private Long repayment_id;
8 |
9 | public boolean isResult() {
10 | return this.result;
11 | }
12 |
13 | public void setResult(final boolean result) {
14 | this.result = result;
15 | }
16 |
17 | public Long getRepayment_id() {
18 | return this.repayment_id;
19 | }
20 |
21 | public void setRepayment_id(final Long repayment_id) {
22 | this.repayment_id = repayment_id;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/ResponseResult.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | import java.io.Serializable;
4 |
5 | public class ResponseResult implements Serializable {
6 |
7 | private final T data;
8 |
9 | private ResponseResult(final T data) {
10 | this.data = data;
11 | }
12 |
13 | public static ResponseResult success() {
14 | return ResponseResult.success(new Object());
15 | }
16 |
17 | public static ResponseResult success(final T data) {
18 | return ResponseResult.build(data);
19 | }
20 |
21 | public static ResponseResult build(final T data) {
22 | return new ResponseResult(data);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/ServerTimeDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class ServerTimeDto {
4 | private Long epoch;
5 | private String iso;
6 |
7 | public Long getEpoch() {
8 | return epoch;
9 | }
10 |
11 | public void setEpoch(Long epoch) {
12 | this.epoch = epoch;
13 | }
14 |
15 | public String getIso() {
16 | return iso;
17 | }
18 |
19 | public void setIso(String iso) {
20 | this.iso = iso;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/Trade.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class Trade {
4 | private String timestamp;
5 | private Integer trade_id;
6 | private String price;
7 | private String size;
8 | private String side;
9 | private String time;
10 |
11 | public String getTimestamp() {
12 | return this.timestamp;
13 | }
14 |
15 | public void setTimestamp(final String timestamp) {
16 | this.timestamp = timestamp;
17 | }
18 |
19 | public Integer getTrade_id() {
20 | return this.trade_id;
21 | }
22 |
23 | public void setTrade_id(final Integer trade_id) {
24 | this.trade_id = trade_id;
25 | }
26 |
27 | public String getPrice() {
28 | return this.price;
29 | }
30 |
31 | public void setPrice(final String price) {
32 | this.price = price;
33 | }
34 |
35 | public String getSize() {
36 | return this.size;
37 | }
38 |
39 | public void setSize(final String size) {
40 | this.size = size;
41 | }
42 |
43 | public String getSide() {
44 | return this.side;
45 | }
46 |
47 | public void setSide(final String side) {
48 | this.side = side;
49 | }
50 |
51 | public String getTime() {
52 | return this.time;
53 | }
54 |
55 | public void setTime(final String time) {
56 | this.time = time;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/bean/spot/result/UserMarginBillDto.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.bean.spot.result;
2 |
3 | public class UserMarginBillDto {
4 | private Long ledger_id;
5 | private String timestamp;
6 | private String amount;
7 | private String balance;
8 | private String type;
9 | private UserMarginBillDto.Details details;
10 |
11 | public String getTimestamp() {
12 | return this.timestamp;
13 | }
14 |
15 | public void setTimestamp(final String timestamp) {
16 | this.timestamp = timestamp;
17 | }
18 |
19 | public Long getLedger_id() {
20 | return this.ledger_id;
21 | }
22 |
23 | public void setLedger_id(final Long ledger_id) {
24 | this.ledger_id = ledger_id;
25 | }
26 |
27 |
28 | public String getAmount() {
29 | return this.amount;
30 | }
31 |
32 | public void setAmount(final String amount) {
33 | this.amount = amount;
34 | }
35 |
36 | public String getBalance() {
37 | return this.balance;
38 | }
39 |
40 | public void setBalance(final String balance) {
41 | this.balance = balance;
42 | }
43 |
44 | public String getType() {
45 | return this.type;
46 | }
47 |
48 | public void setType(final String type) {
49 | this.type = type;
50 | }
51 |
52 | public UserMarginBillDto.Details getDetails() {
53 | return this.details;
54 | }
55 |
56 | public void setDetails(final UserMarginBillDto.Details details) {
57 | this.details = details;
58 | }
59 |
60 | public static class Details {
61 | private Long order_id;
62 | private String instrument_id;
63 |
64 | public Long getOrder_id() {
65 | return this.order_id;
66 | }
67 |
68 | public void setOrder_id(final Long order_id) {
69 | this.order_id = order_id;
70 | }
71 |
72 | public String getInstrument_id() {
73 | return this.instrument_id;
74 | }
75 |
76 | public void setInstrument_id(final String instrument_id) {
77 | this.instrument_id = instrument_id;
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/client/APICredentials.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.client;
2 |
3 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
4 |
5 | /**
6 | * API Credentials.
7 | * The api key and secret key will be randomly generated and provided by okex.com.
8 | *
9 | * @author Tony Tian
10 | * @version 1.0.0
11 | * @date 2018/3/8 14:14
12 | */
13 | public class APICredentials {
14 | /**
15 | * The user's secret key provided by OKEx.
16 | */
17 | private String apiKey;
18 | /**
19 | * The private key used to sign your request data.
20 | */
21 | private String secretKey;
22 | /**
23 | * The Passphrase will be provided by you to further secure your API access.
24 | */
25 | private String passphrase;
26 |
27 |
28 | public APICredentials(APIConfiguration config) {
29 | super();
30 | this.apiKey = config.getApiKey();
31 | this.secretKey = config.getSecretKey();
32 | this.passphrase = config.getPassphrase();
33 | }
34 |
35 | public String getApiKey() {
36 | return apiKey;
37 | }
38 |
39 | public void setApiKey(String apiKey) {
40 | this.apiKey = apiKey;
41 | }
42 |
43 | public String getSecretKey() {
44 | return secretKey;
45 | }
46 |
47 | public void setSecretKey(String secretKey) {
48 | this.secretKey = secretKey;
49 | }
50 |
51 | public String getPassphrase() {
52 | return passphrase;
53 | }
54 |
55 | public void setPassphrase(String passphrase) {
56 | this.passphrase = passphrase;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/client/APIRetrofit.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.client;
2 |
3 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
4 | import okhttp3.OkHttpClient;
5 | import retrofit2.Retrofit;
6 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
7 | import retrofit2.converter.gson.GsonConverterFactory;
8 | import retrofit2.converter.scalars.ScalarsConverterFactory;
9 |
10 | /**
11 | * API Retrofit
12 | *
13 | * @author Tony Tian
14 | * @version 1.0.0
15 | * @date 2018/3/8 15:40
16 | */
17 | public class APIRetrofit {
18 |
19 |
20 | private APIConfiguration config;
21 | private OkHttpClient client;
22 |
23 | public APIRetrofit(APIConfiguration config, OkHttpClient client) {
24 | this.config = config;
25 | this.client = client;
26 | }
27 |
28 | /**
29 | * Get a retrofit 2 object.
30 | */
31 | public Retrofit retrofit() {
32 | Retrofit.Builder builder = new Retrofit.Builder();
33 | builder.client(this.client);
34 | builder.addConverterFactory(ScalarsConverterFactory.create());
35 | builder.addConverterFactory(GsonConverterFactory.create());
36 | builder.addCallAdapterFactory(RxJavaCallAdapterFactory.create());
37 | builder.baseUrl(this.config.getEndpoint());
38 | return builder.build();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/AlgorithmEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Algorithm Name
5 | *
6 | * @author Tony Tian
7 | * @date Created in 2018/1/31 13:00
8 | */
9 | public enum AlgorithmEnum {
10 |
11 | HMAC_SHA256("HmacSHA256"),
12 | MD5("MD5"),;
13 |
14 | private String algorithm;
15 |
16 | AlgorithmEnum(String algorithm) {
17 | this.algorithm = algorithm;
18 | }
19 |
20 | public String algorithm() {
21 | return algorithm;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/CharsetEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Charset Enum
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/2/5 21:22
9 | */
10 | public enum CharsetEnum {
11 |
12 | UTF_8("UTF-8"),
13 | ISO_8859_1("ISO-8859-1"),;
14 |
15 |
16 | private String charset;
17 |
18 | CharsetEnum(String charset) {
19 | this.charset = charset;
20 | }
21 |
22 | public String charset() {
23 | return charset;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/ContentTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Content-Type Enum: MediaType: Internet Media Type
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/1/31 17:49
9 | */
10 | public enum ContentTypeEnum {
11 |
12 | APPLICATION_JSON("application/json"),
13 | APPLICATION_JSON_UTF8("application/json; charset=UTF-8"),
14 | // The server does not support types
15 | APPLICATION_FORM("application/x-www-form-urlencoded; charset=UTF-8"),;
16 |
17 |
18 | private String contentType;
19 |
20 | ContentTypeEnum(String contentType) {
21 | this.contentType = contentType;
22 | }
23 |
24 | public String contentType() {
25 | return contentType;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/FuturesCurrenciesEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Futures Currencies (Updated on: 2018-03-13 17:39:09)
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/13 17:37
9 | */
10 | public enum FuturesCurrenciesEnum {
11 |
12 | BTC(0), LTC(1), ETH(2), ETC(4), BCH(5), XRP(15), EOS(20), BTG(10);
13 | private int symbol;
14 |
15 | FuturesCurrenciesEnum(int symbol) {
16 | this.symbol = symbol;
17 | }
18 |
19 | public int getSymbol() {
20 | return symbol;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/FuturesTransactionTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Transaction type
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/9 15:49
9 | */
10 | public enum FuturesTransactionTypeEnum {
11 |
12 | OPEN_LONG(1), OPEN_SHORT(2), CLOSE_LONG(3), CLOSE_SHORT(4),;
13 |
14 | private int code;
15 |
16 | FuturesTransactionTypeEnum(int code) {
17 | this.code = code;
18 | }
19 |
20 | public int code() {
21 | return code;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/HttpHeadersEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Http Headers Enum .
5 | * All REST requests must contain the following headers.
6 | * The api key and secret key will be randomly generated and provided by OKEX.
7 | * The Passphrase will be provided by you to further secure your API access.
8 | * OKEX stores the salted hash of your passphrase for verification, but cannot recover the passphrase if you forget it.
9 | * OKEX cursor pagination response headers.
10 | * Request page before (newer) and after (older) this pagination id,
11 | * and limit number of results per request. maximum 100. (default 100).
12 | *
13 | * @author Tony Tian
14 | * @version 1.0.0
15 | * @date 2018/2/5 20:45
16 | */
17 | public enum HttpHeadersEnum {
18 |
19 | OK_ACCESS_KEY("OK-ACCESS-KEY"),
20 | OK_ACCESS_SIGN("OK-ACCESS-SIGN"),
21 | OK_ACCESS_TIMESTAMP("OK-ACCESS-TIMESTAMP"),
22 | OK_ACCESS_PASSPHRASE("OK-ACCESS-PASSPHRASE"),
23 |
24 | OK_BEFORE("OK-BEFORE"),
25 | OK_AFTER("OK-AFTER"),
26 | OK_LIMIT("OK-LIMIT"),
27 | OK_FROM("OK-FROM"),
28 | OK_TO("OK-TO");
29 |
30 | private final String header;
31 |
32 | HttpHeadersEnum(final String header) {
33 | this.header = header;
34 | }
35 |
36 | public String header() {
37 | return this.header;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/HttpMethodEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Http Method Enum
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/8 13:53
9 | */
10 | public enum HttpMethodEnum {
11 | GET,
12 | HEAD,
13 | POST,
14 | PUT,
15 | PATCH,
16 | DELETE,
17 | OPTIONS,
18 | TRACE;
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/HttpStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * Http Status
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/2/5 20:38
9 | */
10 | public enum HttpStatusEnum {
11 |
12 | OK(200, "OK", "The request is Successful."),
13 | BAD_REQUEST(400, "Bad Request", "Invalid request format."),
14 | UNAUTHORIZED(401, "Unauthorized", "Invalid authorization."),
15 | FORBIDDEN(403, "Forbidden", "You do not have access to the requested resource."),
16 | NOT_FOUND(404, "Not Found", "Request resource path error."),
17 | TOO_MANY_REQUESTS(429, "Too Many Requests", "When a rate limit is exceeded."),
18 | INTERNAL_SERVER_ERROR(500, "Internal Server Error", "We had a problem with our server."),;
19 |
20 | private int status;
21 | private String message;
22 | private String comment;
23 |
24 | HttpStatusEnum(int status, String message, String comment) {
25 | this.status = status;
26 | this.message = message;
27 | this.comment = comment;
28 | }
29 |
30 | public int status() {
31 | return status;
32 | }
33 |
34 | public String message() {
35 | return message;
36 | }
37 |
38 | public String comment() {
39 | return comment;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/enums/I18nEnum.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.enums;
2 |
3 | /**
4 | * internationalization
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/8 16:20
9 | */
10 | public enum I18nEnum {
11 | ENGLISH("en_US"),
12 | SIMPLIFIED_CHINESE("zh_CN"),
13 | //zh_TW || zh_HK
14 | TRADITIONAL_CHINESE("zh_HK"),;
15 |
16 | private String i18n;
17 |
18 | I18nEnum(String i18n) {
19 | this.i18n = i18n;
20 | }
21 |
22 | public String i18n() {
23 | return i18n;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/exception/APIException.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.exception;
2 |
3 | /**
4 | * API Exception
5 | *
6 | * @author Tony Tian
7 | * @version 1.0.0
8 | * @date 2018/3/8 19:59
9 | */
10 | public class APIException extends RuntimeException {
11 |
12 | private int code;
13 |
14 | public APIException(String message) {
15 | super(message);
16 | }
17 |
18 | public APIException(int code, String message) {
19 | super(message);
20 | this.code = code;
21 | }
22 |
23 |
24 | public APIException(Throwable cause) {
25 | super(cause);
26 | }
27 |
28 | public APIException(String message, Throwable cause) {
29 | super(message, cause);
30 | }
31 |
32 | @Override
33 | public String getMessage() {
34 | if (this.code != 0) {
35 | return this.code + " : " + super.getMessage();
36 | }
37 | return super.getMessage();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/GeneralAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.futures.result.ExchangeRate;
4 | import com.okcoin.commons.okex.open.api.bean.futures.result.ServerTime;
5 |
6 | /**
7 | * OKEX general api
8 | *
9 | * @author Tony Tian
10 | * @version 1.0.0
11 | * @date 2018/3/9 16:06
12 | */
13 | public interface GeneralAPIService {
14 | /**
15 | * Time of the server running OKEX's REST API.
16 | */
17 | ServerTime getServerTime();
18 |
19 | /**
20 | * The exchange rate of legal tender pairs
21 | */
22 | ExchangeRate getExchangeRate();
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/account/AccountAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.account;
2 |
3 | import com.alibaba.fastjson.JSONArray;
4 | import com.alibaba.fastjson.JSONObject;
5 | import com.okcoin.commons.okex.open.api.bean.account.param.Transfer;
6 | import com.okcoin.commons.okex.open.api.bean.account.param.Withdraw;
7 | import com.okcoin.commons.okex.open.api.bean.account.result.Currency;
8 | import com.okcoin.commons.okex.open.api.bean.account.result.Ledger;
9 | import com.okcoin.commons.okex.open.api.bean.account.result.Wallet;
10 | import com.okcoin.commons.okex.open.api.bean.account.result.WithdrawFee;
11 |
12 | import java.math.BigDecimal;
13 | import java.util.List;
14 |
15 |
16 | public interface AccountAPIService {
17 |
18 | JSONObject transfer(Transfer transfer);
19 |
20 | JSONObject withdraw(Withdraw withdraw);
21 |
22 | List getCurrencies();
23 |
24 | List getLedger(Integer type, String currency, Integer before, Integer after, int limit);
25 |
26 | List getWallet();
27 |
28 | List getWallet(String currency);
29 |
30 | JSONArray getDepositAddress(String currency);
31 |
32 | List getWithdrawFee(String currency);
33 |
34 | JSONArray getOnHold(String currency);
35 |
36 | JSONObject lock(String currency, BigDecimal amount);
37 |
38 | JSONObject unlock(String currency, BigDecimal amount);
39 |
40 | JSONArray getDepositHistory();
41 |
42 | JSONArray getDepositHistory(String currency);
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/account/impl/AccountAPI.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.account.impl;
2 |
3 | import com.alibaba.fastjson.JSONArray;
4 | import com.alibaba.fastjson.JSONObject;
5 | import com.okcoin.commons.okex.open.api.bean.account.result.Currency;
6 | import com.okcoin.commons.okex.open.api.bean.account.result.Ledger;
7 | import com.okcoin.commons.okex.open.api.bean.account.result.Wallet;
8 | import com.okcoin.commons.okex.open.api.bean.account.result.WithdrawFee;
9 | import retrofit2.Call;
10 | import retrofit2.http.*;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Account api
16 | *
17 | * @author hucj
18 | * @version 1.0.0
19 | * @date 2018/07/04 20:51
20 | */
21 | public interface AccountAPI {
22 |
23 |
24 | @POST("/api/account/v3/transfer")
25 | Call transfer(@Body JSONObject jsonObject);
26 |
27 |
28 | @POST("/api/account/v3/withdrawal")
29 | Call withdraw(@Body JSONObject jsonObject);
30 |
31 | @GET("/api/account/v3/currencies")
32 | Call> getCurrencies();
33 |
34 | @GET("/api/account/v3/ledger")
35 | Call> getLedger(@Query("txn_type") Integer type, @Query("currency") String currency,
36 | @Query("before") Integer before, @Query("after") Integer after, @Query("limit") int limit);
37 |
38 | @GET("/api/account/v3/wallet")
39 | Call> getWallet();
40 |
41 | @GET("/api/account/v3/wallet/{currency}")
42 | Call> getWallet(@Path("currency") String currency);
43 |
44 | @GET("/api/account/v3/deposit/address")
45 | Call getDepositAddress(@Query("currency") String currency);
46 |
47 | @GET("/api/account/v3/withdrawal/fee")
48 | Call> getWithdrawFee(@Query("currency") String currency);
49 |
50 | @GET("/api/account/v3/onhold")
51 | Call getOnHold(@Query("currency") String currency);
52 |
53 | @POST("/api/account/v3/lock")
54 | Call lock(@Body JSONObject jsonObject);
55 |
56 | @POST("/api/account/v3/unlock")
57 | Call unlock(@Body JSONObject jsonObject);
58 |
59 | @GET("/api/account/v3/deposit/history")
60 | Call getDepositHistory();
61 |
62 | @GET("/api/account/v3/deposit/history/{currency}")
63 | Call getDepositHistory(@Path("currency") String currency);
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/EttAccountAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.CursorPager;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttAccount;
5 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttLedger;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author chuping.cui
11 | * @date 2018/7/4
12 | */
13 | public interface EttAccountAPIService {
14 |
15 | /**
16 | * Get all ett account list
17 | *
18 | * @return account info list
19 | */
20 | List getAccount();
21 |
22 | /**
23 | * Get ett currency account
24 | *
25 | * @param currency currency code
26 | * @return account info
27 | */
28 | EttAccount getAccount(String currency);
29 |
30 | /**
31 | * Get ett account ledger list
32 | *
33 | * @param currency currency code
34 | * @param before before and after cursors are available via response headers OK-BEFORE and OK-AFTER. Your requests should use these cursor values when making requests for pages after the initial
35 | * request. {@link CursorPager}
36 | * @param after before and after cursors are available via response headers OK-BEFORE and OK-AFTER. Your requests should use these cursor values when making requests for pages after the initial
37 | * request. {@link CursorPager}
38 | * @param limit number of results per request.
39 | * @return
40 | */
41 | CursorPager getLedger(String currency, String before, String after, int limit);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/EttOrderAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.CursorPager;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCancelOrderResult;
5 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCreateOrderResult;
6 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttOrder;
7 |
8 | import java.math.BigDecimal;
9 |
10 | /**
11 | * @author chuping.cui
12 | * @date 2018/7/4
13 | */
14 | public interface EttOrderAPIService {
15 |
16 | /**
17 | * Create a ett order
18 | *
19 | * @param ett ett name
20 | * @param type order type. 1. usdt subscription 2. usdt redemption 3. underlying redemption
21 | * @param amount subscription usdt size
22 | * @param size redemption ett size
23 | * @param clientOid client order id
24 | * @return create order result
25 | */
26 | EttCreateOrderResult createOrder(String ett, Integer type, BigDecimal amount, BigDecimal size, String clientOid);
27 |
28 | /**
29 | * Cancel order
30 | *
31 | * @param orderId order id
32 | * @return cancel order result
33 | */
34 | EttCancelOrderResult cancelOrder(String orderId);
35 |
36 | /**
37 | * Get all of ett account order list
38 | *
39 | * @param ett ett name
40 | * @param type order type. 1. subscription 2. redemption
41 | * @param status order status. 0. all 1. waiting 2. done 3. canceled
42 | * @param before before and after cursors are available via response headers OK-BEFORE and OK-AFTER. Your requests should use these cursor values when making requests for pages after the initial
43 | * request. {@link CursorPager}
44 | * @param after before and after cursors are available via response headers OK-BEFORE and OK-AFTER. Your requests should use these cursor values when making requests for pages after the initial
45 | * request. {@link CursorPager}
46 | * @param limit Number of results per request.
47 | * @return order info list
48 | */
49 | CursorPager getOrder(String ett, Integer type, Integer status, String before, String after, int limit);
50 |
51 | /**
52 | * Get the ett account order info
53 | *
54 | * @param orderId order id
55 | * @return order info
56 | */
57 | EttOrder getOrder(String orderId);
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/EttProductAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttConstituentsResult;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttSettlementDefinePrice;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author chuping.cui
10 | * @date 2018/7/4
11 | */
12 | public interface EttProductAPIService {
13 |
14 | /**
15 | * Get ett constituents
16 | *
17 | * @param ett ett name
18 | * @return constituents
19 | */
20 | EttConstituentsResult getConstituents(String ett);
21 |
22 | /**
23 | * Get ett settlement plan define price
24 | *
25 | * @param ett ett name
26 | * @return settlement plan define price list
27 | */
28 | List getDefinePrice(String ett);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttAccountAPI.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttAccount;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttLedger;
5 | import retrofit2.Call;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Path;
8 | import retrofit2.http.Query;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author chuping.cui
14 | * @date 2018/7/5
15 | */
16 | interface EttAccountAPI {
17 |
18 | @GET("/api/ett/v3/accounts")
19 | Call> getAccount();
20 |
21 | @GET("/api/ett/v3/accounts/{currency}")
22 | Call getAccount(@Path("currency") String currency);
23 |
24 | @GET("/api/ett/v3/accounts/{currency}/ledger")
25 | Call> getLedger(@Path("currency") String currency, @Query("before") String before, @Query("after") String after, @Query("limit") int limit);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttAccountAPIServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.CursorPager;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttAccount;
5 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttLedger;
6 | import com.okcoin.commons.okex.open.api.client.APIClient;
7 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
8 | import com.okcoin.commons.okex.open.api.service.ett.EttAccountAPIService;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author chuping.cui
14 | * @date 2018/7/5
15 | */
16 | public class EttAccountAPIServiceImpl implements EttAccountAPIService {
17 |
18 | private final APIClient client;
19 | private final EttAccountAPI api;
20 |
21 | public EttAccountAPIServiceImpl(APIConfiguration config) {
22 | this.client = new APIClient(config);
23 | this.api = this.client.createService(EttAccountAPI.class);
24 | }
25 |
26 | @Override
27 | public List getAccount() {
28 | return this.client.executeSync(this.api.getAccount());
29 | }
30 |
31 | @Override
32 | public EttAccount getAccount(String currency) {
33 | return this.client.executeSync(this.api.getAccount(currency));
34 | }
35 |
36 | @Override
37 | public CursorPager getLedger(String currency, String before, String after, int limit) {
38 | return this.client.executeSyncCursorPager(this.api.getLedger(currency, before, after, limit));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttOrderAPI.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.param.EttCreateOrderParam;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCancelOrderResult;
5 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCreateOrderResult;
6 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttOrder;
7 | import retrofit2.Call;
8 | import retrofit2.http.*;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author chuping.cui
14 | * @date 2018/7/5
15 | */
16 | interface EttOrderAPI {
17 |
18 | @POST("/api/ett/v3/orders")
19 | Call createOrder(@Body EttCreateOrderParam param);
20 |
21 | @DELETE("/api/ett/v3/orders/{orderId}")
22 | Call cancelOrder(@Path("orderId") String orderId);
23 |
24 | @GET("/api/ett/v3/orders")
25 | Call> getOrder(@Query("ett") String ett, @Query("type") Integer type, @Query("status") Integer status, @Query("before") String before, @Query("after") String after,
26 | @Query("limit") int limit);
27 |
28 | @GET("/api/ett/v3/orders/{orderId}")
29 | Call getOrder(@Path("orderId") String orderId);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttOrderAPIServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.param.EttCreateOrderParam;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.CursorPager;
5 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCancelOrderResult;
6 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttCreateOrderResult;
7 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttOrder;
8 | import com.okcoin.commons.okex.open.api.client.APIClient;
9 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
10 | import com.okcoin.commons.okex.open.api.service.ett.EttOrderAPIService;
11 |
12 | import java.math.BigDecimal;
13 |
14 | /**
15 | * @author chuping.cui
16 | * @date 2018/7/5
17 | */
18 | public class EttOrderAPIServiceImpl implements EttOrderAPIService {
19 |
20 | private final APIClient client;
21 | private final EttOrderAPI api;
22 |
23 | public EttOrderAPIServiceImpl(APIConfiguration config) {
24 | this.client = new APIClient(config);
25 | this.api = this.client.createService(EttOrderAPI.class);
26 | }
27 |
28 | @Override
29 | public EttCreateOrderResult createOrder(String ett, Integer type, BigDecimal amount, BigDecimal size, String clientOid) {
30 | EttCreateOrderParam param = new EttCreateOrderParam();
31 | param.setEtt(ett);
32 | param.setType(type);
33 | param.setAmount(amount);
34 | param.setSize(size);
35 | param.setClientOid(clientOid);
36 | return this.client.executeSync(this.api.createOrder(param));
37 | }
38 |
39 | @Override
40 | public EttCancelOrderResult cancelOrder(String orderId) {
41 | return this.client.executeSync(this.api.cancelOrder(orderId));
42 | }
43 |
44 | @Override
45 | public CursorPager getOrder(String ett, Integer type, Integer status, String before, String after, int limit) {
46 | return this.client.executeSyncCursorPager(this.api.getOrder(ett, type, status, before, after, limit));
47 | }
48 |
49 | @Override
50 | public EttOrder getOrder(String orderId) {
51 | return this.client.executeSync(this.api.getOrder(orderId));
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttProductAPI.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttConstituentsResult;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttSettlementDefinePrice;
5 | import retrofit2.Call;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Path;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author chuping.cui
13 | * @date 2018/7/5
14 | */
15 | interface EttProductAPI {
16 |
17 | @GET("/api/ett/v3/constituents/{ett}")
18 | Call getConstituents(@Path("ett") String ett);
19 |
20 | @GET("/api/ett/v3/define-price/{ett}")
21 | Call> getDefinePrice(@Path("ett") String ett);
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/ett/impl/EttProductAPIServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.ett.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttConstituentsResult;
4 | import com.okcoin.commons.okex.open.api.bean.ett.result.EttSettlementDefinePrice;
5 | import com.okcoin.commons.okex.open.api.client.APIClient;
6 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
7 | import com.okcoin.commons.okex.open.api.service.ett.EttProductAPIService;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author chuping.cui
13 | * @date 2018/7/5
14 | */
15 | public class EttProductAPIServiceImpl implements EttProductAPIService {
16 |
17 | private final APIClient client;
18 | private final EttProductAPI api;
19 |
20 | public EttProductAPIServiceImpl(APIConfiguration config) {
21 | this.client = new APIClient(config);
22 | this.api = this.client.createService(EttProductAPI.class);
23 | }
24 |
25 | @Override
26 | public EttConstituentsResult getConstituents(String ett) {
27 | return this.client.executeSync(this.api.getConstituents(ett));
28 | }
29 |
30 | @Override
31 | public List getDefinePrice(String ett) {
32 | return this.client.executeSync(this.api.getDefinePrice(ett));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/futures/impl/GeneralAPIServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.futures.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.futures.result.ExchangeRate;
4 | import com.okcoin.commons.okex.open.api.bean.futures.result.ServerTime;
5 | import com.okcoin.commons.okex.open.api.client.APIClient;
6 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
7 | import com.okcoin.commons.okex.open.api.service.GeneralAPIService;
8 |
9 | /**
10 | * General api
11 | *
12 | * @author Tony Tian
13 | * @version 1.0.0
14 | * @date 10/03/2018 19:28
15 | */
16 | public class GeneralAPIServiceImpl implements GeneralAPIService {
17 |
18 | private APIClient client;
19 | private FuturesMarketAPI api;
20 |
21 | public GeneralAPIServiceImpl(APIConfiguration config) {
22 | this.client = new APIClient(config);
23 | this.api = client.createService(FuturesMarketAPI.class);
24 | }
25 |
26 | @Override
27 | public ServerTime getServerTime() {
28 | return this.client.executeSync(this.api.getServerTime());
29 | }
30 |
31 | @Override
32 | public ExchangeRate getExchangeRate() {
33 | return this.client.executeSync(this.api.getExchangeRate());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/spot/MarginOrderAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.spot;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import com.okcoin.commons.okex.open.api.bean.spot.param.OrderParamDto;
5 | import com.okcoin.commons.okex.open.api.bean.spot.param.PlaceOrderParam;
6 | import com.okcoin.commons.okex.open.api.bean.spot.result.Fills;
7 | import com.okcoin.commons.okex.open.api.bean.spot.result.OrderInfo;
8 | import com.okcoin.commons.okex.open.api.bean.spot.result.OrderResult;
9 |
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * 杠杆订单相关接口
15 | */
16 | public interface MarginOrderAPIService {
17 | /**
18 | * 添加订单
19 | *
20 | * @param order
21 | * @return
22 | */
23 | OrderResult addOrder(PlaceOrderParam order);
24 |
25 | /**
26 | * 批量下单
27 | *
28 | * @param order
29 | * @return
30 | */
31 | Map> addOrders(List order);
32 |
33 | /**
34 | * 取消指定的订单 delete协议
35 | *
36 | * @param orderId
37 | */
38 | OrderResult cancleOrderByOrderId(final PlaceOrderParam order, String orderId);
39 |
40 | /**
41 | * 取消指定的订单 post协议
42 | *
43 | * @param orderId
44 | */
45 | OrderResult cancleOrderByOrderId_post(final PlaceOrderParam order, String orderId);
46 |
47 | /**
48 | * 批量取消订单 delete协议
49 | *
50 | * @param cancleOrders
51 | * @return
52 | */
53 | Map cancleOrders(final List cancleOrders);
54 |
55 | /**
56 | * 批量取消订单 post协议
57 | *
58 | * @param cancleOrders
59 | * @return
60 | */
61 | Map cancleOrders_post(final List cancleOrders);
62 |
63 | /**
64 | * 查询订单
65 | *
66 | * @param instrumentId
67 | * @param orderId
68 | * @return
69 | */
70 | OrderInfo getOrderByProductIdAndOrderId(String instrumentId, String orderId);
71 |
72 | /**
73 | * 订单列表
74 | *
75 | * @param instrumentId
76 | * @param status
77 | * @param from
78 | * @param to
79 | * @param limit
80 | * @return
81 | */
82 | List getOrders(String instrumentId, String status, String from, String to, String limit);
83 |
84 | /**
85 | * /* 订单列表
86 | *
87 | * @param from
88 | * @param to
89 | * @param limit
90 | * @return
91 | */
92 | List getPendingOrders(String from, String to, String limit, String instrument_id);
93 |
94 | /**
95 | * 账单列表
96 | *
97 | * @param orderId
98 | * @param instrumentId
99 | * @param from
100 | * @param to
101 | * @param limit
102 | * @return
103 | */
104 | List getFills(String orderId, String instrumentId, String from, String to, String limit);
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/spot/SpotAccountAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.spot;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.spot.result.Account;
4 | import com.okcoin.commons.okex.open.api.bean.spot.result.Ledger;
5 | import com.okcoin.commons.okex.open.api.bean.spot.result.ServerTimeDto;
6 |
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | /**
11 | * 币币资产相关接口
12 | */
13 | public interface SpotAccountAPIService {
14 |
15 | /**
16 | * 系统时间
17 | *
18 | * @return
19 | */
20 | ServerTimeDto time();
21 |
22 | /**
23 | * 挖矿相关数据
24 | *
25 | * @return
26 | */
27 | Map getMiningData();
28 |
29 |
30 | /**
31 | * 账户资产列表
32 | *
33 | * @return
34 | */
35 | List getAccounts();
36 |
37 | /**
38 | * 账单列表
39 | *
40 | * @param currency
41 | * @param from
42 | * @param to
43 | * @param limit
44 | * @return
45 | */
46 | List getLedgersByCurrency(String currency, String from, String to, String limit);
47 |
48 | /**
49 | * 单币资产
50 | *
51 | * @param currency
52 | * @return
53 | */
54 | Account getAccountByCurrency(final String currency);
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/spot/SpotProductAPIService.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.spot;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.spot.result.*;
4 |
5 | import java.math.BigDecimal;
6 | import java.util.List;
7 |
8 | public interface SpotProductAPIService {
9 |
10 | /**
11 | * 单个币对行情
12 | *
13 | * @param product
14 | * @return
15 | */
16 | Ticker getTickerByProductId(String product);
17 |
18 | /**
19 | * 行情列表
20 | *
21 | * @return
22 | */
23 | List getTickers();
24 |
25 | /**
26 | * @param product
27 | * @param size
28 | * @param depth
29 | * @return
30 | */
31 | Book bookProductsByProductId(String product, String size, BigDecimal depth);
32 |
33 | /**
34 | * 币对列表
35 | *
36 | * @return
37 | */
38 | List getProducts();
39 |
40 | /**
41 | * 交易列表
42 | *
43 | * @param product
44 | * @param from
45 | * @param to
46 | * @param limit
47 | * @return
48 | */
49 | List getTrades(String product, String from, String to, String limit);
50 |
51 | /**
52 | * @param product
53 | * @param granularity
54 | * @param start
55 | * @param end
56 | * @return
57 | */
58 | List getCandles(String product, String granularity, String start, String end);
59 |
60 | List getCandles_1(String product, String granularity, String start, String end);
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/okcoin/commons/okex/open/api/service/spot/impl/MarginAccountAPIServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.okcoin.commons.okex.open.api.service.spot.impl;
2 |
3 | import com.okcoin.commons.okex.open.api.bean.spot.result.*;
4 | import com.okcoin.commons.okex.open.api.client.APIClient;
5 | import com.okcoin.commons.okex.open.api.config.APIConfiguration;
6 | import com.okcoin.commons.okex.open.api.service.spot.MarginAccountAPIService;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | /**
12 | *
13 | */
14 | public class MarginAccountAPIServiceImpl implements MarginAccountAPIService {
15 |
16 | private final APIClient client;
17 | private final MarginAccountAPI api;
18 |
19 | public MarginAccountAPIServiceImpl(final APIConfiguration config) {
20 | this.client = new APIClient(config);
21 | this.api = this.client.createService(MarginAccountAPI.class);
22 | }
23 |
24 |
25 | @Override
26 | public List