-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathBitsoFee.java
More file actions
142 lines (115 loc) · 4.14 KB
/
Copy pathBitsoFee.java
File metadata and controls
142 lines (115 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package com.bitso;
import com.bitso.helpers.Helpers;
import org.json.JSONArray;
import org.json.JSONObject;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator;
public class BitsoFee {
private HashMap<String, Fee> mTradeFees;
private HashMap<String, String> mWithdrawalFees;
public BitsoFee(JSONObject o) {
processTradeFees(o);
processWithdrawalFees(o);
}
private void processTradeFees(JSONObject o) {
mTradeFees = new HashMap<String, Fee>();
JSONArray jsonFees = o.getJSONArray("fees");
int totalElements = jsonFees.length();
for (int i = 0; i < totalElements; i++) {
JSONObject fee = jsonFees.getJSONObject(i);
String book = Helpers.getString(fee, "book");
Fee currentFee = new Fee(book, Helpers.getBD(fee, "fee_decimal"),
Helpers.getBD(fee, "fee_percent"),
Helpers.getBD(fee, "taker_fee_decimal"),
Helpers.getBD(fee, "taker_fee_percent"),
Helpers.getBD(fee, "maker_fee_decimal"),
Helpers.getBD(fee, "maker_fee_percent")
);
mTradeFees.put(book, currentFee);
}
}
private void processWithdrawalFees(JSONObject o) {
mWithdrawalFees = new HashMap<String, String>();
JSONObject withdrawalFees = o.getJSONObject("withdrawal_fees");
Iterator<String> it = withdrawalFees.keys();
while (it.hasNext()) {
String key = it.next();
mWithdrawalFees.put(key, withdrawalFees.getString(key));
}
}
public HashMap<String, Fee> getTradeFees() {
return mTradeFees;
}
public void setTradeFees(HashMap<String, Fee> mTradeFees) {
this.mTradeFees = mTradeFees;
}
public HashMap<String, String> getWithdrawalFees() {
return mWithdrawalFees;
}
public void setWithdrawalFees(HashMap<String, String> mWithdrawalFees) {
this.mWithdrawalFees = mWithdrawalFees;
}
public String toString() {
return Helpers.fieldPrinter(this, BitsoFee.class);
}
public class Fee {
private String mBook;
@Deprecated
private BigDecimal mFeeDecimal;
@Deprecated
private BigDecimal mFeePercent;
private BigDecimal mTakerFeeDecimal;
private BigDecimal mTakerFeePercent;
private BigDecimal mMakerFeeDecimal;
private BigDecimal mMakerFeePercent;
public Fee(String mBook, BigDecimal mFeeDecimal, BigDecimal mFeePercent, BigDecimal mTakerFeeDecimal,
BigDecimal mTakerFeePercent, BigDecimal mMakerFeeDecimal, BigDecimal mMakerFeePercent) {
super();
this.mBook = mBook;
this.mFeeDecimal = mFeeDecimal;
this.mFeePercent = mFeePercent;
this.mTakerFeeDecimal = mTakerFeeDecimal;
this.mTakerFeePercent = mTakerFeePercent;
this.mMakerFeeDecimal = mMakerFeeDecimal;
this.mMakerFeePercent = mMakerFeePercent;
}
public String getBook() {
return mBook;
}
public void setBook(String mBook) {
this.mBook = mBook;
}
@Deprecated
public BigDecimal getFeeDecimal() {
return mFeeDecimal;
}
@Deprecated
public void setFeeDecimal(BigDecimal mFeeDecimal) {
this.mFeeDecimal = mFeeDecimal;
}
@Deprecated
public BigDecimal getFeePercent() {
return mFeePercent;
}
@Deprecated
public void setFeePercent(BigDecimal mFeePercent) {
this.mFeePercent = mFeePercent;
}
public String toString() {
return Helpers.fieldPrinter(this, BitsoFee.Fee.class);
}
public BigDecimal getTakerFeePercent() {
return mTakerFeePercent;
}
public BigDecimal getTakerFeeDecimal() {
return mTakerFeeDecimal;
}
public BigDecimal getMakerFeePercent() {
return mMakerFeePercent;
}
public BigDecimal getMakerFeeDecimal() {
return mMakerFeeDecimal;
}
}
}