questions) {
+ this.questions = questions;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyDetailsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyDetailsRequest.java
new file mode 100644
index 0000000..d94a7f7
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyDetailsRequest.java
@@ -0,0 +1,41 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.LandingCompanyDetailsResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * LandingCompanyDetailsRequest
+ *
+ * Landing Company Details Send
+ *
+ * Binary.com has a number of licensed subsidiaries in various jurisidictions,
+ * which are called Landing Companies (and which are wholly owned subsidiaries of the Binary Group).
+ * This call provides information about each Landing Company.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class LandingCompanyDetailsRequest extends RequestBase {
+ /**
+ * Landing company shortcode (for example: costarica, malta, maltainvest, iom)
+ */
+ @SerializedName("landing_company_details")
+ private String landingCompanyCode;
+
+ public LandingCompanyDetailsRequest(String landingCompanyCode){
+ this.responseType = LandingCompanyDetailsResponse.class;
+ this.setLandingCompanyCode(landingCompanyCode);
+ }
+
+ public String getLandingCompanyCode() {
+ return landingCompanyCode;
+ }
+
+ public void setLandingCompanyCode(String landingCompanyCode) {
+ Validator.checkPattern("^(\\w|-){3,20}$", landingCompanyCode,
+ "Landing Company Code does not match the regex pattern /^(\\w|-){3,20}$/");
+ this.landingCompanyCode = landingCompanyCode;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyRequest.java
new file mode 100644
index 0000000..ace4e18
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/LandingCompanyRequest.java
@@ -0,0 +1,41 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.LandingCompanyResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * LandingCompanyRequest
+ *
+ * Landing Company Send
+ * Binary.com has a number of licensed subsidiaries in various jurisidictions, which are called Landing Companies.
+ * This call will return the appropriate Landing Company for clients of a given country.
+ * The landing company may differ for gaming contracts (Volatility Indices)
+ * and financial contracts (forex, stock indices, commodities)
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/1/2017
+ */
+public class LandingCompanyRequest extends RequestBase {
+
+ /**
+ * Client country
+ */
+ @SerializedName("landing_company")
+ private String landingCompany;
+
+ public LandingCompanyRequest(String landingCompany){
+ this.responseType = LandingCompanyResponse.class;
+ this.landingCompany = landingCompany;
+ }
+
+ public String getLandingCompany() {
+ return landingCompany;
+ }
+
+ public void setLandingCompany(String landingCompany) {
+ Validator.checkPattern("^\\w{2}$", landingCompany, "LandingCompany value does not match the regex pattern \\^\\w{2}$\\");
+ this.landingCompany = landingCompany;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/LoginHistoryRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/LoginHistoryRequest.java
new file mode 100644
index 0000000..78ac810
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/LoginHistoryRequest.java
@@ -0,0 +1,47 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.LoginHistoryResponse;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * LoginHistoryRequest
+ *
+ * Login History
+ *
+ * Retrieve a summary of login history for user.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/7/2017
+ */
+public class LoginHistoryRequest extends RequestBase {
+
+ @SerializedName("login_history")
+ private final int loginHistory = 1;
+
+ /**
+ * Apply limit to count of login history records, default to 10. Max:50
+ */
+ @SerializedName("limit")
+ @Nullable
+ private Integer limit;
+
+ public LoginHistoryRequest() {
+ this.responseType = LoginHistoryResponse.class;
+ }
+
+ public LoginHistoryRequest(Integer limit) {
+ this();
+ this.setLimit(limit);
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/LogoutRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/LogoutRequest.java
new file mode 100644
index 0000000..4040093
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/LogoutRequest.java
@@ -0,0 +1,25 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.LogoutResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * LogoutReques
+ *
+ * Logout Request
+ *
+ * Logout the session
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/7/2017
+ */
+public class LogoutRequest extends RequestBase {
+
+ @SerializedName("logout")
+ private final int logout = 1;
+
+ public LogoutRequest() {
+ this.responseType = LogoutResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/NewVirtualAccountRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/NewVirtualAccountRequest.java
new file mode 100644
index 0000000..502f799
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/NewVirtualAccountRequest.java
@@ -0,0 +1,182 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.NewVirtualAccountResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * NewVirtualAccountRequest
+ *
+ * Create virtual account Send
+ * Create a new virtual-money account
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class NewVirtualAccountRequest extends RequestBase {
+
+ @SerializedName("new_account_virtual")
+ private final int newAccountVirtual = 1;
+
+ /**
+ * Email verification code (received from a verify_email call, which must be done first)
+ */
+ @SerializedName("verification_code")
+ private String verficationCode;
+
+ /**
+ * Password (length within 6-25 chars, accepts any printable ASCII character)
+ */
+ @SerializedName("client_password")
+ private String clientPassword;
+
+ /**
+ * 2-letter country code (value received from residence_list call)
+ */
+ @SerializedName("residence")
+ private String residence;
+
+ /**
+ * Affiliate token, within 32 characters.
+ */
+ @SerializedName("affiliate_token")
+ @Nullable
+ private String affiliateToken;
+
+ /**
+ * Optional field to identify the source of traffic such as: search engine, newsletter, or other referral
+ */
+ @SerializedName("utm_source")
+ @Nullable
+ private String utmSource;
+
+ /**
+ * Optional field to identify the medium the link was used upon such as: email, CPC, or other methods of sharing
+ */
+ @SerializedName("utm_medium")
+ @Nullable
+ private String utmMedium;
+
+ /**
+ * Optional field to identify a specific product promotion or
+ * strategic campaign such as a spring sale or other promotions
+ */
+ @SerializedName("utm_campaign")
+ @Nullable
+ private String utmCampaign;
+
+ /**
+ * Boolean value 1 or 0, indicating permission to use email address for any contact which may include marketing
+ */
+ @SerializedName("email_consent")
+ @Nullable
+ private Integer emailConsent;
+
+ /**
+ * (Google Click Identifier) to track source
+ */
+ @SerializedName("gclid_url")
+ @Nullable
+ private String googleClickId;
+
+ public NewVirtualAccountRequest(String verficationCode, String clientPassword, String residence){
+ this.responseType = NewVirtualAccountResponse.class;
+ this.setVerficationCode(verficationCode);
+ this.setClientPassword(clientPassword);
+ this.setResidence(residence);
+ }
+
+ public int getNewAccountVirtual() {
+ return newAccountVirtual;
+ }
+
+ public String getVerficationCode() {
+ return verficationCode;
+ }
+
+ public void setVerficationCode(String verficationCode) {
+ Validator.checkPattern("^\\w{8,128}$", verficationCode,
+ "Verification Code does not match the regex pattern /^\\w{8,128}$/");
+ this.verficationCode = verficationCode;
+ }
+
+ public String getClientPassword() {
+ return clientPassword;
+ }
+
+ public void setClientPassword(String clientPassword) {
+ Validator.checkPattern("^[ -~]{6,25}$", clientPassword,
+ "Client Password does not match the regex pattern /^[ -~]{6,25}$/");
+ this.clientPassword = clientPassword;
+ }
+
+ public String getResidence() {
+ return residence;
+ }
+
+ public void setResidence(String residence) {
+ Validator.checkPattern("^[a-z]{2}$", residence, "Residence does not match the regex pattern /^[a-z]{2}$/");
+ this.residence = residence;
+ }
+
+ public String getAffiliateToken() {
+ return affiliateToken;
+ }
+
+ public void setAffiliateToken(String affiliateToken) {
+ Validator.checkPattern("^[\\w-]{0,32}$", affiliateToken,
+ "Affiliate Token does not match the regex pattern /^[\\w-]{0,32}$/");
+ this.affiliateToken = affiliateToken;
+ }
+
+ public String getUtmSource() {
+ return utmSource;
+ }
+
+ public void setUtmSource(String utmSource) {
+ Validator.checkPattern("^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$", utmSource,
+ "UTM Source does not match the regex pattern /^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$/");
+ this.utmSource = utmSource;
+ }
+
+ public String getUtmMedium() {
+ return utmMedium;
+ }
+
+ public void setUtmMedium(String utmMedium) {
+ Validator.checkPattern("^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$", utmMedium,
+ "UTM Medium does not match the regex pattern /^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$/");
+ this.utmMedium = utmMedium;
+ }
+
+ public String getUtmCampaign() {
+ return utmCampaign;
+ }
+
+ public void setUtmCampaign(String utmCampaign) {
+ Validator.checkPattern("^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$", utmCampaign,
+ "UTM Campaign does not match the regex pattern /^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$/");
+ this.utmCampaign = utmCampaign;
+ }
+
+ public Integer getEmailConsent() {
+ return emailConsent;
+ }
+
+ public void setEmailConsent(Integer emailConsent) {
+ Validator.checkPattern("^(0|1)$", emailConsent.toString(), "Email Conset doesn't match the regex patter /^(0|1)$/");
+ this.emailConsent = emailConsent;
+ }
+
+ public String getGoogleClickId() {
+ return googleClickId;
+ }
+
+ public void setGoogleClickId(String googleClickId) {
+ Validator.checkPattern("^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$", googleClickId,
+ "Google Click Identifier URL does not match the regex pattern /^[a-zA-Z0-9\\s\\-\\.\\_]{0,100}$/");
+ this.googleClickId = googleClickId;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/OAuthApplicationsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/OAuthApplicationsRequest.java
new file mode 100644
index 0000000..b2d1495
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/OAuthApplicationsRequest.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.OAuthApplicationResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * OAuthApplicationsRequest
+ *
+ * OAuth Applications Send
+ *
+ * List all my used OAuth applications.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/7/2017
+ */
+public class OAuthApplicationsRequest extends RequestBase {
+
+ @SerializedName("oauth_apps")
+ private final int oauthApps = 1;
+
+ public OAuthApplicationsRequest() {
+ this.responseType = OAuthApplicationResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentListRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentListRequest.java
new file mode 100644
index 0000000..4adbdd8
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentListRequest.java
@@ -0,0 +1,42 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PaymentAgentListResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * PaymentAgentListRequest
+ *
+ * Payment Agent List Send
+ *
+ * Will return a list of Payment Agents for a given country.
+ * Payment agents allow Binary.com users to deposit and withdraw funds using local payment methods
+ * that might not be available via the main Binary.com cashier system.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class PaymentAgentListRequest extends RequestBase {
+
+ /**
+ * Client country (2-letter country code).
+ */
+ @SerializedName("paymentagent_list")
+ private String countryCode;
+
+ public PaymentAgentListRequest(String countryCode) {
+ this.responseType = PaymentAgentListResponse.class;
+ this.setCountryCode(countryCode);
+ }
+
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ public void setCountryCode(String countryCode) {
+ Validator.checkPattern("^\\w\\w$", countryCode,
+ "Country Code does not match the regex pattern /^\\w\\w$/");
+ this.countryCode = countryCode;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentTransferRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentTransferRequest.java
new file mode 100644
index 0000000..311e180
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentTransferRequest.java
@@ -0,0 +1,82 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PaymentAgentTransferResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * PaymentAgentTransferRequest
+ *
+ * Payment Agent Transfer Request
+ * Payment Agent Transfer - this call is available only to accounts that are approved Payment Agents.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/15/2017
+ */
+public class PaymentAgentTransferRequest extends RequestBase {
+
+ @SerializedName("paymentagent_transfer")
+ private final int paymentAgentTransfer = 1;
+
+ /**
+ * The transfer_to loginid
+ */
+ @SerializedName("transfer_to")
+ private String transferTo;
+
+ /**
+ * Currency
+ */
+ @SerializedName("currency")
+ private String currency;
+
+ /**
+ * Amount
+ */
+ @SerializedName("amount")
+ private BigDecimal amount;
+
+ /**
+ * If 1, just do validation
+ */
+ @SerializedName("dry_run")
+ private Integer dryRun;
+
+ public PaymentAgentTransferRequest() {
+ this.responseType = PaymentAgentTransferResponse.class;
+ }
+
+ public String getTransferTo() {
+ return transferTo;
+ }
+
+ public void setTransferTo(String transferTo) {
+ this.transferTo = transferTo;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ public void setAmount(BigDecimal amount) {
+ this.amount = amount;
+ }
+
+ public boolean getDryRun() {
+ return dryRun == 1 ? true : false;
+ }
+
+ public void setDryRun(boolean dryRun) {
+ this.dryRun = dryRun ? 1 : 0;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentWithdrawalRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentWithdrawalRequest.java
new file mode 100644
index 0000000..328c0bb
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PaymentAgentWithdrawalRequest.java
@@ -0,0 +1,110 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PaymentAgentWithdrawalResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * PaymentAgentWithdrawalRequest
+ *
+ * Payment Agent Withdrawal Request
+ * Initiate a withdrawal to an approved Payment Agent.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/15/2017
+ */
+public class PaymentAgentWithdrawalRequest extends RequestBase {
+
+ @SerializedName("paymentagent_withdraw")
+ private final int paymentAgentWithdraw = 1;
+
+ /**
+ * The payment agent loginid received from the paymentagent_list call
+ */
+ @SerializedName("paymentagent_loginid")
+ private String loginId;
+
+ /**
+ * Currency
+ */
+ @SerializedName("currency")
+ private String currency;
+
+ /**
+ * Amount
+ */
+ @SerializedName("amount")
+ private BigDecimal amount;
+
+ /**
+ * Email verification code (received from a verify_email call, which must be done first)
+ */
+ @SerializedName("verification_code")
+ private String verificationCode;
+
+ /**
+ * Optional field for remarks about the withdraw. Only letters, numbers, space, period, comma, - ' are allowed.
+ */
+ @SerializedName("description")
+ private String description;
+
+ /**
+ * If 1, just do validation
+ */
+ @SerializedName("dry_run")
+ private Integer dryRun;
+
+ public PaymentAgentWithdrawalRequest() {
+ this.responseType = PaymentAgentWithdrawalResponse.class;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ public void setAmount(BigDecimal amount) {
+ this.amount = amount;
+ }
+
+ public String getVerificationCode() {
+ return verificationCode;
+ }
+
+ public void setVerificationCode(String verificationCode) {
+ this.verificationCode = verificationCode;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean getDryRun() {
+ return dryRun == 1 ? true : false;
+ }
+
+ public void setDryRun(boolean dryRun) {
+ this.dryRun = dryRun ? 1 : 0;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PayoutCurrenciesRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PayoutCurrenciesRequest.java
new file mode 100644
index 0000000..5c004e2
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PayoutCurrenciesRequest.java
@@ -0,0 +1,25 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PayoutCurrenciesResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * PayoutCurrenciesRequest
+ *
+ * Payout Currencies Send
+ * Retrieve a list of available option payout currencies.
+ * If a user is logged in, only the currency available for his account will be returned.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class PayoutCurrenciesRequest extends RequestBase {
+
+ @SerializedName("payout_currencies")
+ private final int payoutCurrencies = 1;
+
+ public PayoutCurrenciesRequest(){
+ this.responseType = PayoutCurrenciesResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PingRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PingRequest.java
new file mode 100644
index 0000000..83172a0
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PingRequest.java
@@ -0,0 +1,19 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PingResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class PingRequest extends RequestBase {
+
+ @SerializedName("ping")
+ private final int ping = 1;
+
+ public PingRequest(){
+ this.responseType = PingResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PortfolioRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PortfolioRequest.java
new file mode 100644
index 0000000..8f2b84b
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PortfolioRequest.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.PortfolioResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * PortfolioRequest
+ *
+ * Portfolio Send
+ *
+ * Receive information about my current portfolio of outstanding options
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/7/2017
+ */
+public class PortfolioRequest extends RequestBase {
+
+ @SerializedName("portfolio")
+ private final int portfolio = 1;
+
+ public PortfolioRequest() {
+ this.responseType = PortfolioResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/PriceProposalRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/PriceProposalRequest.java
new file mode 100644
index 0000000..faa5f0f
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/PriceProposalRequest.java
@@ -0,0 +1,251 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.BasisTypes;
+import com.suneesh.trading.models.enums.DurationUnits;
+import com.suneesh.trading.models.responses.PriceProposalResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+import java.math.BigDecimal;
+
+/**
+ * PriceProposalRequest
+ *
+ * Get latest price for a specific contract
+ * Get latest price for a specific contract
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class PriceProposalRequest extends RequestBase {
+
+ @SerializedName("proposal")
+ private final int proposal = 1;
+
+ /**
+ * 1 - to initiate a realtime stream of prices.
+ * Note that tick trades, digit trades and less than 24 hours at-the-money contracts for
+ * the following underlying symbols are not streamed: R_100 R_50 R_25 R_75 RDBULL RDBEAR
+ * (this is because their price is constant).
+ */
+ @SerializedName("subscribe")
+ @Nullable
+ private Integer subscribe = null;
+
+ /**
+ * Proposed contract payout or stake value
+ */
+ @SerializedName("amount")
+ private BigDecimal amount;
+
+ /**
+ * Indicate whether amount is 'payout' or 'stake'
+ */
+ @SerializedName("basis")
+ private String basis;
+
+ /**
+ * A valid contract-type
+ */
+ @SerializedName("contract_type")
+ private String contractType;
+
+ /**
+ * This can only be the account-holder's currency
+ */
+ @SerializedName("currency")
+ private String currency;
+
+ /**
+ * For forward-starting contracts, epoch value of the starting time of the contract.
+ */
+ @SerializedName("date_start")
+ @Nullable
+ private Integer dateStart;
+
+ /**
+ * Epoch value of the expiry time of the contract. You must either specify date_expiry or duration.
+ */
+ @SerializedName("date_expiry")
+ @Nullable
+ private Integer dateExpiry;
+
+ /**
+ * Duration quantity
+ */
+ @SerializedName("duration")
+ private int duration;
+
+ /**
+ * Duration unit is s(seconds), m(minutes), h(hours), d(days), t(ticks).
+ * If this parameter is not set then duration will be counted as seconds.
+ */
+ @SerializedName("duration_unit")
+ private String durationUnit;
+
+ /**
+ * Symbol code
+ */
+ @SerializedName("symbol")
+ private String symbol;
+
+ /**
+ * Barrier for the contract (or last digit prediction for digit contracts).
+ * Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-),
+ * meaning that the entry spot would be adjusted accordingly with that amount to define a barrier.
+ */
+ @SerializedName("barrier")
+ private String barrier;
+
+ /**
+ * Low barrier for the contract (for contracts with two barriers).
+ * Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-),
+ * meaning that the entry spot would be adjusted accordingly with that amount to define a barrier.
+ */
+ @SerializedName("barrier2")
+ private String barrier2;
+
+ /**
+ * [For japan only] An epoch value of a predefined trading period start time
+ */
+ @SerializedName("trading_period_start")
+ private String tradingPeriodStart;
+
+ public PriceProposalRequest() {
+ this.responseType = PriceProposalResponse.class;
+ }
+
+ public PriceProposalRequest(String symbol, BigDecimal amount, BasisTypes basis, String contractType,
+ String currency, int duration, DurationUnits durationUnit) {
+ this();
+ this.setSymbol(symbol);
+ this.setAmount(amount);
+ this.setBasis(basis);
+ this.setContractType(contractType);
+ this.setCurrency(currency);
+ this.setDuration(duration);
+ this.setDurationUnit(durationUnit);
+ }
+
+ public Integer getSubscribe() {
+ return subscribe;
+ }
+
+ public void setSubscribe(Integer subscribe) {
+ this.subscribe = subscribe;
+ }
+
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ public void setAmount(BigDecimal amount) {
+ Validator.checkPattern("^[0-9]+([.][0-9]+)?$", amount.toString(),
+ "Amount does not match the regex pattern /^[0-9]+([.][0-9]+)?$/");
+ this.amount = amount;
+ }
+
+ public String getBasis() {
+ return basis;
+ }
+
+ public void setBasis(BasisTypes basis) {
+ this.basis = basis.toString().toLowerCase();
+ }
+
+ public String getContractType() {
+ return contractType;
+ }
+
+ public void setContractType(String contractType) {
+ Validator.checkPattern("^\\w{2,30}$", contractType,
+ "ContractType does not match regex pattern /^\\w{2,30}$/");
+ this.contractType = contractType;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ Validator.checkPattern("^[A-Z]{3}$", currency,
+ "Currency does not match the regex pattern /^[A-Z]{3}$/");
+ this.currency = currency;
+ }
+
+ public int getDateStart() {
+ return dateStart;
+ }
+
+ public void setDateStart(int dateStart) {
+ Validator.checkPattern("^\\d{1,10}$", Integer.toString(dateStart),
+ "Date Start does not match the regex pattern /^\\d{1,10}$/");
+ this.dateStart = dateStart;
+ }
+
+ public int getDateExpiry() {
+ return dateExpiry;
+ }
+
+ public void setDateExpiry(int dateExpiry) {
+ Validator.checkPattern("^\\d{1,10}$", Integer.toString(dateStart),
+ "Date Expiry does not match the regex pattern /^\\d{1,10}$/");
+ this.dateExpiry = dateExpiry;
+ }
+
+ public int getDuration() {
+ return duration;
+ }
+
+ public void setDuration(int duration) {
+ this.duration = duration;
+ }
+
+ public String getDurationUnit() {
+ return durationUnit;
+ }
+
+ public void setDurationUnit(DurationUnits durationUnit) {
+ this.durationUnit = durationUnit.toString().toLowerCase().substring(0, 1);
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ Validator.checkPattern("^\\w{2,30}$", symbol,
+ "Symbol does not match the regex pattern /^\\w{2,30}$/");
+ this.symbol = symbol;
+ }
+
+ public String getBarrier() {
+ return barrier;
+ }
+
+ public void setBarrier(String barrier) {
+ Validator.checkPattern("^[+-]?\\d+\\.?\\d*$", barrier,
+ "Barrier does not match the regex pattern /^[+-]?\\d+\\.?\\d*$/");
+ this.barrier = barrier;
+ }
+
+ public String getBarrier2() {
+ return barrier2;
+ }
+
+ public void setBarrier2(String barrier2) {
+ Validator.checkPattern("^[+-]?\\d+\\.?\\d*$", barrier,
+ "Barrier2 does not match the regex pattern /^[+-]?\\d+\\.?\\d*$/");
+ this.barrier2 = barrier2;
+ }
+
+ public String getTradingPeriodStart() {
+ return tradingPeriodStart;
+ }
+
+ public void setTradingPeriodStart(String tradingPeriodStart) {
+ this.tradingPeriodStart = tradingPeriodStart;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/ProfitTableRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/ProfitTableRequest.java
new file mode 100644
index 0000000..5293cfd
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/ProfitTableRequest.java
@@ -0,0 +1,127 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.SortTypes;
+import com.suneesh.trading.models.responses.ProfitTableResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * ProfitTableRequest
+ *
+ * Profit Table Send
+ *
+ * Retrieve a summary of account Profit Table, according to given search criteria
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class ProfitTableRequest extends RequestBase {
+
+ @SerializedName("profit_table")
+ private final int profitTable = 1;
+
+ /**
+ * If set to 1, will return full contracts description.
+ */
+ @SerializedName("description")
+ @Nullable
+ private Integer description;
+
+ /**
+ * Apply upper limit to count of transactions received
+ */
+ @SerializedName("limit")
+ @Nullable
+ private Integer limit;
+
+ /**
+ * Skip this many transactions
+ */
+ @SerializedName("offset")
+ @Nullable
+ private Integer offset;
+
+ /**
+ * Optional start date (epoch or YYYY-MM-DD)
+ */
+ @SerializedName("date_from")
+ @Nullable
+ private String date_from;
+
+ /**
+ * Optional end date (epoch or YYYY-MM-DD)
+ */
+ @SerializedName("date_to")
+ @Nullable
+ private String date_to;
+
+ /**
+ * sort direction, default DESC
+ */
+ @SerializedName("sort")
+ @Nullable
+ private String sort;
+
+ public ProfitTableRequest() {
+ this.responseType = ProfitTableResponse.class;
+ }
+
+ public boolean getDescription() {
+ return description == 1 ? true : false;
+ }
+
+ public void setDescription(boolean description) {
+ this.description = description ? 1 : null;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ Validator.checkPattern("^\\d{1,3}$", limit.toString(),
+ "Limit does not match the regex pattern /^\\d{1,3}$/");
+ this.limit = limit;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ this.offset = offset;
+ }
+
+ public String getDate_from() {
+ return date_from;
+ }
+
+ public void setDate_from(String date_from) {
+ Validator.checkPattern("^(\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])|\\d{1,10})$",
+ date_from,
+ "DateFrom does not match the regex pattern /^(\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])|\\d{1,10})$/");
+ this.date_from = date_from;
+ }
+
+ public String getDate_to() {
+ return date_to;
+ }
+
+ public void setDate_to(String date_to) {
+ Validator.checkPattern("^(\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])|\\d{1,10})$",
+ date_to,
+ "DateTo does not match the regex pattern /^(\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])|\\d{1,10})$/");
+ this.date_to = date_to;
+ }
+
+ public String getSort() {
+ return sort;
+ }
+
+ public void setSort(SortTypes sort) {
+ this.sort = sort.toString();
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/ProposalOpenContractRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/ProposalOpenContractRequest.java
new file mode 100644
index 0000000..a3887cb
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/ProposalOpenContractRequest.java
@@ -0,0 +1,64 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.ProposalOpenContractResponse;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * ProposalOpenContractRequest
+ *
+ * Latest price for an open contract
+ *
+ * Get latest price (and other information) for a contract in the user's portfolio
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class ProposalOpenContractRequest extends RequestBase {
+
+ @SerializedName("proposal_open_contract")
+ private final int proposalOpenContract = 1;
+
+ /**
+ * Contract id received from a Portfolio request. If not set, you will receive stream of all open contracts.
+ */
+ @SerializedName("contract_id")
+ private Long contractId;
+
+ /**
+ * If set to 1, will send updates whenever the price changes
+ */
+ @SerializedName("subscribe")
+ @Nullable
+ private Integer subscribe = null;
+
+
+ public ProposalOpenContractRequest(Long contractId) {
+ this.responseType = ProposalOpenContractResponse.class;
+ this.contractId = contractId;
+ }
+
+ public ProposalOpenContractRequest(Long contractId, Boolean subscribe) {
+ this.responseType = ProposalOpenContractResponse.class;
+ this.contractId = contractId;
+ this.subscribe = subscribe? 1: null;
+ }
+
+ public Long getContractId() {
+ return contractId;
+ }
+
+ public void setContractId(Long contractId) {
+ this.contractId = contractId;
+ }
+
+ public Integer getSubscribe() {
+ return subscribe;
+ }
+
+ public void setSubscribe(Integer subscribe) {
+ this.subscribe = subscribe;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/RealityCheckRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/RealityCheckRequest.java
new file mode 100644
index 0000000..9bbb801
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/RealityCheckRequest.java
@@ -0,0 +1,28 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.RealityCheckResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * RealityCheckRequest
+ *
+ * Reality check send
+ *
+ * Retrieve summary of client's trades and account for the Reality Check facility.
+ * A 'reality check' means a display of time elapsed since the session began, and associated client profit/loss.
+ * The Reality Check facility is a regulatory requirement for certain landing companies.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class RealityCheckRequest extends RequestBase {
+
+ @SerializedName("reality_check")
+ private final int realityCheck = 1;
+
+ public RealityCheckRequest() {
+ this.responseType = RealityCheckResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/RequestBase.java b/Trading/src/main/java/com/suneesh/trading/models/requests/RequestBase.java
new file mode 100644
index 0000000..e623f3e
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/RequestBase.java
@@ -0,0 +1,49 @@
+package com.suneesh.trading.models.requests;
+
+import com.google.gson.JsonObject;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+import java.lang.reflect.Type;
+
+/**
+ * Created by morteza on 7/19/2017.
+ */
+
+public class RequestBase {
+ @SerializedName("passthrough")
+ JsonObject passThrough;
+
+ @SerializedName("req_id")
+ @Nullable
+ Integer id = null;
+
+ @Expose
+ transient Type responseType;
+
+ public JsonObject getPassThrough() {
+ return passThrough;
+ }
+
+ public void setPassThrough(JsonObject passThrough) {
+ this.passThrough = passThrough;
+ }
+
+ @Nullable
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(@Nullable Integer id) {
+ this.id = id;
+ }
+
+ public Type getResponseType() {
+ return responseType;
+ }
+
+ public void setResponseType(Type responseType) {
+ this.responseType = responseType;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/ResidenceListRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/ResidenceListRequest.java
new file mode 100644
index 0000000..c7edeb1
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/ResidenceListRequest.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.ResidenceListResponce;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * ResidenceListRequest
+ *
+ * Residence List Send
+ *
+ * This call returns a list of countries and 2-letter country codes, suitable for populating the account opening form.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class ResidenceListRequest extends RequestBase {
+
+ @SerializedName("residence_list")
+ private final int residentList = 1;
+
+ public ResidenceListRequest(){
+ this.responseType = ResidenceListResponce.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/RevokeOauthApplicationRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/RevokeOauthApplicationRequest.java
new file mode 100644
index 0000000..10a71d8
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/RevokeOauthApplicationRequest.java
@@ -0,0 +1,27 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.RevokeOauthApplicationResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * RevokeOauthApplicationRequest
+ *
+ * Revoke Oauth Framework Send
+ *
+ * Used for revoking access of particular app.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/4/2017
+ */
+public class RevokeOauthApplicationRequest extends RequestBase {
+
+ @SerializedName("revoke_oauth_app")
+ private Long appId;
+
+ public RevokeOauthApplicationRequest(Long appId) {
+ this.responseType = RevokeOauthApplicationResponse.class;
+ this.appId = appId;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractForMultipleAccountsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractForMultipleAccountsRequest.java
new file mode 100644
index 0000000..a8ca4de
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractForMultipleAccountsRequest.java
@@ -0,0 +1,81 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.SellContractForMultipleAccountsResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * SellContractForMultipleAccounts
+ *
+ * Sell multiple contracts
+ *
+ * Sell contracts for multiple accounts simultaneously. Uses the shortcode response from buy_contract_for_multiple_accounts to identify the contract,
+ * and authorisation tokens to select which accounts to sell those contracts on. Note that only the accounts identified by the tokens will be affected.
+ * This will not sell the contract on the currently-authorised account unless you include the token for the current account.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class SellContractForMultipleAccountsRequest extends RequestBase {
+
+ @SerializedName("sell_contract_for_multiple_accounts")
+ private final int sellContractForMultipleAccounts = 1;
+
+ /**
+ * An internal ID used to identify the contract which was originally bought.
+ * This is returned from the buy and buy_for_multiple_accounts calls.
+ */
+ @SerializedName("shortcode")
+ private String shortCode;
+
+ /**
+ * Authorisation tokens which select the accounts to sell use for the affected accounts
+ */
+ @SerializedName("tokens")
+ private List tokens;
+
+ /**
+ * Minimum price at which to sell the contract, or '0' for 'sell at market'
+ */
+ @SerializedName("price")
+ private BigDecimal price;
+
+ private SellContractForMultipleAccountsRequest() {
+ this.responseType = SellContractForMultipleAccountsResponse.class;
+ }
+
+ public SellContractForMultipleAccountsRequest(String shortCode, BigDecimal price, List tokens) {
+ this();
+ this.price = price;
+ this.tokens = tokens;
+ this.shortCode = shortCode;
+ }
+
+ public String getShortCode() {
+ return shortCode;
+ }
+
+ public void setShortCode(String shortCode) {
+ this.shortCode = shortCode;
+ }
+
+ public List getTokens() {
+ return tokens;
+ }
+
+ public void setTokens(List tokens) {
+ this.tokens = tokens;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractRequest.java
new file mode 100644
index 0000000..9c457d2
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SellContractRequest.java
@@ -0,0 +1,59 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.SellContractResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * SellContractRequest
+ *
+ * Sell a Contract Send
+ *
+ * Sell a Contract as identified from a previous Portfolio call
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class SellContractRequest extends RequestBase {
+
+ /**
+ * Pass contract_id received from the Portfolio call
+ */
+ @SerializedName("sell")
+ private Long contractId;
+
+ /**
+ * Minimum price at which to sell the contract, or '0' for 'sell at market'
+ */
+ @SerializedName("price")
+ private BigDecimal price;
+
+ private SellContractRequest() {
+ this.responseType = SellContractResponse.class;
+ }
+
+ public SellContractRequest(Long contractId, BigDecimal price) {
+ this();
+ this.price = price;
+ this.contractId = contractId;
+ }
+
+ public Long getContractId() {
+ return contractId;
+ }
+
+ public void setContractId(Long contractId) {
+ this.contractId = contractId;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SellExpiredContractsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SellExpiredContractsRequest.java
new file mode 100644
index 0000000..9d1219c
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SellExpiredContractsRequest.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.SellExpiredContractsResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * SellExpiredContractsRequest
+ *
+ * Sell expired contracts
+ *
+ * This call will try to sell any expired contracts and return the number of sold contracts.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class SellExpiredContractsRequest extends RequestBase {
+
+ @SerializedName("sell_expired")
+ private final int sellExpired = 1;
+
+ public SellExpiredContractsRequest() {
+ this.responseType = SellExpiredContractsResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountCurrencyRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountCurrencyRequest.java
new file mode 100644
index 0000000..00b212b
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountCurrencyRequest.java
@@ -0,0 +1,39 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.SetAccountCurrencyResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * SetAccountCurrencyRequest
+ *
+ * Set Account Currency
+ *
+ * Set account currency, this will be default currency for your account i.e currency for trading, deposit.
+ * Please note that account currency can only be set once, and then can never be changed.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/4/2017
+ */
+public class SetAccountCurrencyRequest extends RequestBase {
+
+ /**
+ * Currency of the account. List of supported currencies can be acquired with 'payout_currencies' call
+ */
+ @SerializedName("set_account_currency")
+ private String accountCurrency;
+
+ public SetAccountCurrencyRequest(String accountCurrency) {
+ this.responseType = SetAccountCurrencyResponse.class;
+ this.accountCurrency = accountCurrency;
+ }
+
+ public String getAccountCurrency() {
+ return accountCurrency;
+ }
+
+ public void setAccountCurrency(String accountCurrency) {
+ this.accountCurrency = accountCurrency;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountSettingsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountSettingsRequest.java
new file mode 100644
index 0000000..5b9dec6
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SetAccountSettingsRequest.java
@@ -0,0 +1,220 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.AccountOpeningReasons;
+import com.suneesh.trading.models.responses.SetAccountSettingsResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/13/2017
+ */
+public class SetAccountSettingsRequest extends RequestBase {
+
+ @SerializedName("set_settings")
+ private final int setSettings = 1;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("address_line_1")
+ private String firstLineAddress;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("address_line_2")
+ private String secondLineAddress;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("address_city")
+ private String city;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("address_state")
+ private String state;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("address_postcode")
+ private String postcode;
+
+ /**
+ * Note: not applicable for virtual account. Required field for real money account.
+ */
+ @SerializedName("phone")
+ private String phone;
+
+ /**
+ * 2-letter country code. Note: not applicable for real money account.
+ * Only allow for Virtual account without residence set.
+ */
+ @SerializedName("residence")
+ private String residence;
+
+ /**
+ * Boolean value 1 or 0, indicating permission to use email address for any contact which may include marketing
+ */
+ @SerializedName("email_consent")
+ private Integer emailConsent;
+
+ /**
+ * Place of birth, 2-letter country code.
+ */
+ @SerializedName("place_of_birth")
+ private String placeOfBirth;
+
+ /**
+ * Residence for tax purpose. Comma separated iso country code if multiple jurisdictions.
+ * Only applicable for real money account. Required for maltainvest landing company.
+ */
+ @SerializedName("tax_residence")
+ private String taxResidence;
+
+ /**
+ * Tax identification number. Only applicable for real money account. Required for maltainvest landing company.
+ */
+ @SerializedName("tax_identification_number")
+ private String taxIdentificationNumber;
+
+ /**
+ * Purpose and reason for requesting the account opening.
+ * Only applicable for real money account. Required for clients that have not set it yet. Can only be set once.
+ */
+ @SerializedName("account_opening_reason")
+ private String accountOpeningReason;
+
+ /**
+ * Boolean value 1 or 0, indicating permission to allow others to follow your trades.
+ * Note: not applicable for Virtual account. Only allow for real money account.
+ */
+ @SerializedName("allow_copiers")
+ private Integer allowCopiers;
+
+ /**
+ * Japan real money client settings, only applicable for Japan real money account client.
+ */
+ @SerializedName("jp_settings")
+ private JapanAccountSetting japanAccountSetting;
+
+ public SetAccountSettingsRequest() {
+ this.responseType = SetAccountSettingsResponse.class;
+ }
+
+ public String getFirstLineAddress() {
+ return firstLineAddress;
+ }
+
+ public void setFirstLineAddress(String firstLineAddress) {
+ this.firstLineAddress = firstLineAddress;
+ }
+
+ public String getSecondLineAddress() {
+ return secondLineAddress;
+ }
+
+ public void setSecondLineAddress(String secondLineAddress) {
+ this.secondLineAddress = secondLineAddress;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getPostcode() {
+ return postcode;
+ }
+
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getResidence() {
+ return residence;
+ }
+
+ public void setResidence(String residence) {
+ this.residence = residence;
+ }
+
+ public boolean getEmailConsent() {
+ return emailConsent == 1 ? true : false;
+ }
+
+ public void setEmailConsent(boolean emailConsent) {
+ this.emailConsent = emailConsent ? 1 : 0;
+ }
+
+ public String getPlaceOfBirth() {
+ return placeOfBirth;
+ }
+
+ public void setPlaceOfBirth(String placeOfBirth) {
+ this.placeOfBirth = placeOfBirth;
+ }
+
+ public String getTaxResidence() {
+ return taxResidence;
+ }
+
+ public void setTaxResidence(String taxResidence) {
+ this.taxResidence = taxResidence;
+ }
+
+ public String getTaxIdentificationNumber() {
+ return taxIdentificationNumber;
+ }
+
+ public void setTaxIdentificationNumber(String taxIdentificationNumber) {
+ this.taxIdentificationNumber = taxIdentificationNumber;
+ }
+
+ public String getAccountOpeningReason() {
+ return accountOpeningReason;
+ }
+
+ public void setAccountOpeningReason(AccountOpeningReasons accountOpeningReason) {
+ this.accountOpeningReason = accountOpeningReason.toString();
+ }
+
+ public boolean getAllowCopiers() {
+ return allowCopiers == 1 ? true : false;
+ }
+
+ public void setAllowCopiers(boolean allowCopiers) {
+ this.allowCopiers = allowCopiers ? 1 : 0;
+ }
+
+ public JapanAccountSetting getJapanAccountSetting() {
+ return japanAccountSetting;
+ }
+
+ public void setJapanAccountSetting(JapanAccountSetting japanAccountSetting) {
+ this.japanAccountSetting = japanAccountSetting;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SetFinancialAssessmentRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SetFinancialAssessmentRequest.java
new file mode 100644
index 0000000..b71097c
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SetFinancialAssessmentRequest.java
@@ -0,0 +1,323 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.*;
+import com.suneesh.trading.models.responses.SetFinancialAssessmentResponse;
+import com.google.gson.annotations.SerializedName;
+import com.suneesh.trading.models.enums.*;
+
+/**
+ * SetFinancialAssessmentRequest
+ *
+ * Save Financial assessment details send
+ *
+ * This call sets the financial assessement details based on the client's answers to analyse
+ * whether he possess the experience and knowledge to understand the risks involved with binary options trading.
+ * Not applicable for Japan landing company.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/4/2017
+ */
+public class SetFinancialAssessmentRequest extends RequestBase {
+
+ @SerializedName("set_financial_assessment")
+ private final int setFinancialAssessment = 1;
+
+ /**
+ * Forex trading experience
+ */
+ @SerializedName("forex_trading_experience")
+ private String forexTradingExperience;
+
+ /**
+ * Forex trading frequency
+ */
+ @SerializedName("forex_trading_frequency")
+ private String forexTradingFrequency;
+
+ /**
+ * Indices trading experience
+ */
+ @SerializedName("indices_trading_experience")
+ private String indicesTradingExperience;
+
+ /**
+ * Indices trading frequency
+ */
+ @SerializedName("indices_trading_frequency")
+ private String indicesTradingFrequency;
+
+ /**
+ * Commodities trading experience
+ */
+ @SerializedName("commodities_trading_experience")
+ private String commoditiesTradingExperience;
+
+ /**
+ * Commodities trading frequency
+ */
+ @SerializedName("commodities_trading_frequency")
+ private String commoditiesTradingFrequency;
+
+ /**
+ * Stocks trading experience
+ */
+ @SerializedName("stocks_trading_experience")
+ private String stocksTradingExperience;
+
+ /**
+ * Stocks trading frequency
+ */
+ @SerializedName("stocks_trading_frequency")
+ private String stocksTradingFrequency;
+
+ /**
+ * Binary options or other financial derivatives trading experience
+ */
+ @SerializedName("other_derivatives_trading_experience")
+ private String otherDerivativesTradingExperience;
+
+ /**
+ * Binary options or other derivatives trading frequency
+ */
+ @SerializedName("other_derivatives_trading_frequency")
+ private String otherDerivativesTradingFrequency;
+
+ /**
+ * Other financial instruments trading experience
+ */
+ @SerializedName("other_instruments_trading_experience")
+ private String otherInstrumentsTradingExperience;
+
+ /**
+ * Other financial instruments trading frequency
+ */
+ @SerializedName("other_instruments_trading_frequency")
+ private String otherInstrumentsTradingFrequency;
+
+ /**
+ * Industry of Employment
+ */
+ @SerializedName("employment_industry")
+ private String employmentIndustry;
+
+ /**
+ * Level of education
+ */
+ @SerializedName("education_level")
+ private String educationLevel;
+
+ /**
+ * Income source
+ */
+ @SerializedName("income_source")
+ private String incomeSource;
+
+ /**
+ * Net annual income
+ */
+ @SerializedName("net_income")
+ private String netIncome;
+
+ /**
+ * Estimated Net worth
+ */
+ @SerializedName("estimated_worth")
+ private String estimatedWorth;
+
+ /**
+ * The anticipated account turnover
+ */
+ @SerializedName("account_turnover")
+ private String accountTurnover;
+
+ /**
+ * Occupation
+ */
+ @SerializedName("occupation")
+ private String occupation;
+
+ /**
+ * Employment status
+ */
+ @SerializedName("employment_status")
+ private String employmentStatus;
+
+ /**
+ * Source of wealth
+ */
+ @SerializedName("source_of_wealth")
+ private String sourceOfWealth;
+
+ public SetFinancialAssessmentRequest() {
+ this.responseType = SetFinancialAssessmentResponse.class;
+ }
+
+ public String getForexTradingExperience() {
+ return forexTradingExperience;
+ }
+
+ public void setForexTradingExperience(ExperienceDuration forexTradingExperience) {
+ this.forexTradingExperience = forexTradingExperience.toString();
+ }
+
+ public String getForexTradingFrequency() {
+ return forexTradingFrequency;
+ }
+
+ public void setForexTradingFrequency(TradeFrequency forexTradingFrequency) {
+ this.forexTradingFrequency = forexTradingFrequency.toString();
+ }
+
+ public String getIndicesTradingExperience() {
+ return indicesTradingExperience;
+ }
+
+ public void setIndicesTradingExperience(ExperienceDuration indicesTradingExperience) {
+ this.indicesTradingExperience = indicesTradingExperience.toString();
+ }
+
+ public String getIndicesTradingFrequency() {
+ return indicesTradingFrequency;
+ }
+
+ public void setIndicesTradingFrequency(TradeFrequency indicesTradingFrequency) {
+ this.indicesTradingFrequency = indicesTradingFrequency.toString();
+ }
+
+ public String getCommoditiesTradingExperience() {
+ return commoditiesTradingExperience;
+ }
+
+ public void setCommoditiesTradingExperience(ExperienceDuration commoditiesTradingExperience) {
+ this.commoditiesTradingExperience = commoditiesTradingExperience.toString();
+ }
+
+ public String getCommoditiesTradingFrequency() {
+ return commoditiesTradingFrequency;
+ }
+
+ public void setCommoditiesTradingFrequency(TradeFrequency commoditiesTradingFrequency) {
+ this.commoditiesTradingFrequency = commoditiesTradingFrequency.toString();
+ }
+
+ public String getStocksTradingExperience() {
+ return stocksTradingExperience;
+ }
+
+ public void setStocksTradingExperience(ExperienceDuration stocksTradingExperience) {
+ this.stocksTradingExperience = stocksTradingExperience.toString();
+ }
+
+ public String getStocksTradingFrequency() {
+ return stocksTradingFrequency;
+ }
+
+ public void setStocksTradingFrequency(TradeFrequency stocksTradingFrequency) {
+ this.stocksTradingFrequency = stocksTradingFrequency.toString();
+ }
+
+ public String getOtherDerivativesTradingExperience() {
+ return otherDerivativesTradingExperience;
+ }
+
+ public void setOtherDerivativesTradingExperience(ExperienceDuration otherDerivativesTradingExperience) {
+ this.otherDerivativesTradingExperience = otherDerivativesTradingExperience.toString();
+ }
+
+ public String getOtherDerivativesTradingFrequency() {
+ return otherDerivativesTradingFrequency;
+ }
+
+ public void setOtherDerivativesTradingFrequency(TradeFrequency otherDerivativesTradingFrequency) {
+ this.otherDerivativesTradingFrequency = otherDerivativesTradingFrequency.toString();
+ }
+
+ public String getOtherInstrumentsTradingExperience() {
+ return otherInstrumentsTradingExperience;
+ }
+
+ public void setOtherInstrumentsTradingExperience(ExperienceDuration otherInstrumentsTradingExperience) {
+ this.otherInstrumentsTradingExperience = otherInstrumentsTradingExperience.toString();
+ }
+
+ public String getOtherInstrumentsTradingFrequency() {
+ return otherInstrumentsTradingFrequency;
+ }
+
+ public void setOtherInstrumentsTradingFrequency(TradeFrequency otherInstrumentsTradingFrequency) {
+ this.otherInstrumentsTradingFrequency = otherInstrumentsTradingFrequency.toString();
+ }
+
+ public String getEmploymentIndustry() {
+ return employmentIndustry;
+ }
+
+ public void setEmploymentIndustry(EmploymentIndustries employmentIndustry) {
+ this.employmentIndustry = employmentIndustry.toString();
+ }
+
+ public String getEducationLevel() {
+ return educationLevel;
+ }
+
+ public void setEducationLevel(EducationLevels educationLevel) {
+ this.educationLevel = educationLevel.toString();
+ }
+
+ public String getIncomeSource() {
+ return incomeSource;
+ }
+
+ public void setIncomeSource(IncomeSources incomeSource) {
+ this.incomeSource = incomeSource.toString();
+ }
+
+ public String getNetIncome() {
+ return netIncome;
+ }
+
+ public void setNetIncome(TurnoverRanges netIncome) {
+ this.netIncome = netIncome.toString();
+ }
+
+ public String getEstimatedWorth() {
+ return estimatedWorth;
+ }
+
+ public void setEstimatedWorth(EstimatedWorth estimatedWorth) {
+ this.estimatedWorth = estimatedWorth.toString();
+ }
+
+ public String getAccountTurnover() {
+ return accountTurnover;
+ }
+
+ public void setAccountTurnover(TurnoverRanges accountTurnover) {
+ this.accountTurnover = accountTurnover.toString();
+ }
+
+ public String getOccupation() {
+ return occupation;
+ }
+
+ public void setOccupation(Occupations occupation) {
+ this.occupation = occupation.toString();
+ }
+
+ public String getEmploymentStatus() {
+ return employmentStatus;
+ }
+
+ public void setEmploymentStatus(EmploymentStatuses employmentStatus) {
+ this.employmentStatus = employmentStatus.toString();
+ }
+
+ public String getSourceOfWealth() {
+ return sourceOfWealth;
+ }
+
+ public void setSourceOfWealth(WealthSources sourceOfWealth) {
+ this.sourceOfWealth = sourceOfWealth.toString();
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/SetSelfExclusionSettingsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/SetSelfExclusionSettingsRequest.java
new file mode 100644
index 0000000..188b226
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/SetSelfExclusionSettingsRequest.java
@@ -0,0 +1,175 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.SetSelfExclusionSettingsResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/12/2017
+ */
+public class SetSelfExclusionSettingsRequest extends RequestBase {
+
+ @SerializedName("set_self_exclusion")
+ private final int setSelfExclusion = 1;
+
+ /**
+ * Maximum account cash balance
+ */
+ @SerializedName("max_balance")
+ private BigDecimal maxBalance;
+
+ /**
+ * Daily turnover limit
+ */
+ @SerializedName("max_turnover")
+ private BigDecimal maxTurnover;
+
+ /**
+ * Daily limit on losses
+ */
+ @SerializedName("max_losses")
+ private BigDecimal maxLosses;
+
+ /**
+ * 7-day turnover limit
+ */
+ @SerializedName("max_7day_turnover")
+ private BigDecimal maxSevenDayTurnover;
+
+ /**
+ * 7-day limit on losses
+ */
+ @SerializedName("max_7day_losses")
+ private BigDecimal maxSevenDayLosses;
+
+ /**
+ * 30-day turnover limit
+ */
+ @SerializedName("max_30day_turnover")
+ private BigDecimal maxThirtyDayTurnover;
+
+ /**
+ * 30-day limit on losses
+ */
+ @SerializedName("max_30day_losses")
+ private BigDecimal maxThirtyDayLosses;
+
+ /**
+ * Maximum number of open positions
+ */
+ @SerializedName("max_open_bets")
+ private Integer maxOpenBets;
+
+ /**
+ * Session duration limit, in minutes
+ */
+ @SerializedName("session_duration_limit")
+ private Integer sessionDurationLimit;
+
+ /**
+ * Exclude me from the website until
+ */
+ @SerializedName("exclude_until")
+ private String excludeUntil;
+
+ /**
+ * Exclude me from the website until (epoch time)
+ */
+ @SerializedName("timeout_until")
+ private Long timeoutUntil;
+
+ public SetSelfExclusionSettingsRequest(){
+ this.responseType = SetSelfExclusionSettingsResponse.class;
+ }
+
+ public BigDecimal getMaxBalance() {
+ return maxBalance;
+ }
+
+ public void setMaxBalance(BigDecimal maxBalance) {
+ this.maxBalance = maxBalance;
+ }
+
+ public BigDecimal getMaxTurnover() {
+ return maxTurnover;
+ }
+
+ public void setMaxTurnover(BigDecimal maxTurnover) {
+ this.maxTurnover = maxTurnover;
+ }
+
+ public BigDecimal getMaxLosses() {
+ return maxLosses;
+ }
+
+ public void setMaxLosses(BigDecimal maxLosses) {
+ this.maxLosses = maxLosses;
+ }
+
+ public BigDecimal getMaxSevenDayTurnover() {
+ return maxSevenDayTurnover;
+ }
+
+ public void setMaxSevenDayTurnover(BigDecimal maxSevenDayTurnover) {
+ this.maxSevenDayTurnover = maxSevenDayTurnover;
+ }
+
+ public BigDecimal getMaxSevenDayLosses() {
+ return maxSevenDayLosses;
+ }
+
+ public void setMaxSevenDayLosses(BigDecimal maxSevenDayLosses) {
+ this.maxSevenDayLosses = maxSevenDayLosses;
+ }
+
+ public BigDecimal getMaxThirtyDayTurnover() {
+ return maxThirtyDayTurnover;
+ }
+
+ public void setMaxThirtyDayTurnover(BigDecimal maxThirtyDayTurnover) {
+ this.maxThirtyDayTurnover = maxThirtyDayTurnover;
+ }
+
+ public BigDecimal getMaxThirtyDayLosses() {
+ return maxThirtyDayLosses;
+ }
+
+ public void setMaxThirtyDayLosses(BigDecimal maxThirtyDayLosses) {
+ this.maxThirtyDayLosses = maxThirtyDayLosses;
+ }
+
+ public Integer getMaxOpenBets() {
+ return maxOpenBets;
+ }
+
+ public void setMaxOpenBets(Integer maxOpenBets) {
+ this.maxOpenBets = maxOpenBets;
+ }
+
+ public Integer getSessionDurationLimit() {
+ return sessionDurationLimit;
+ }
+
+ public void setSessionDurationLimit(Integer sessionDurationLimit) {
+ this.sessionDurationLimit = sessionDurationLimit;
+ }
+
+ public String getExcludeUntil() {
+ return excludeUntil;
+ }
+
+ public void setExcludeUntil(String excludeUntil) {
+ this.excludeUntil = excludeUntil;
+ }
+
+ public Long getTimeoutUntil() {
+ return timeoutUntil;
+ }
+
+ public void setTimeoutUntil(Long timeoutUntil) {
+ this.timeoutUntil = timeoutUntil;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/StartCopyTradeRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/StartCopyTradeRequest.java
new file mode 100644
index 0000000..c28d8bd
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/StartCopyTradeRequest.java
@@ -0,0 +1,110 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.StartCopyTradeResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * StartCopyTradeRequest
+ *
+ * Copy Start Send
+ *
+ * Start copy trader bets
+ *
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class StartCopyTradeRequest extends RequestBase {
+
+ /**
+ * API tokens identifying the accounts of trader which will be used to copy trades
+ *
+ */
+ @SerializedName("copy_start")
+ private String traderToken;
+
+ /**
+ * Optional field, used to set minimal trade stake to be copied
+ *
+ */
+ @SerializedName("min_trade_stake")
+ private BigDecimal minTradeStake;
+
+ /**
+ * Optional field, used to set maximum trade stake to be copied
+ *
+ */
+ @SerializedName("max_trade_stake")
+ private BigDecimal maxTradeStake;
+
+ /**
+ * Optional field, used to set assets to be copied. E.x ["frxUSDJPY", "R_50"]
+ *
+ */
+ @SerializedName("assets")
+ private List assets;
+
+ /**
+ * Optional field, used to set trade types to be copied. E.x ["CALL", "PUT"]
+ *
+ */
+ @SerializedName("trade_types")
+ private List tradeTypes;
+
+ private StartCopyTradeRequest() {
+ this.responseType = StartCopyTradeResponse.class;
+ }
+
+ public StartCopyTradeRequest(String traderToken) {
+ this();
+ this.setTraderToken(traderToken);
+ }
+
+ public String getTraderToken() {
+ return traderToken;
+ }
+
+ public void setTraderToken(String traderToken) {
+ Validator.checkPattern("^[\\w\\s-]{15,32}$", traderToken,
+ "Trader Token does not match the regex pattern /^[\\w\\s-]{15,32}$/");
+ this.traderToken = traderToken;
+ }
+
+ public BigDecimal getMinTradeStake() {
+ return minTradeStake;
+ }
+
+ public void setMinTradeStake(BigDecimal minTradeStake) {
+ this.minTradeStake = minTradeStake;
+ }
+
+ public BigDecimal getMaxTradeStake() {
+ return maxTradeStake;
+ }
+
+ public void setMaxTradeStake(BigDecimal maxTradeStake) {
+ this.maxTradeStake = maxTradeStake;
+ }
+
+ public List getAssets() {
+ return assets;
+ }
+
+ public void setAssets(List assets) {
+ this.assets = assets;
+ }
+
+ public List getTradeTypes() {
+ return tradeTypes;
+ }
+
+ public void setTradeTypes(List tradeTypes) {
+ this.tradeTypes = tradeTypes;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/StatementRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/StatementRequest.java
new file mode 100644
index 0000000..c0930d8
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/StatementRequest.java
@@ -0,0 +1,125 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.TransactionType;
+import com.suneesh.trading.models.responses.StatementResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * StatementRequest
+ *
+ *
Statement Send
+ *
+ * Retrieve a summary of account transactions, according to given search criteria
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/7/2017
+ */
+public class StatementRequest extends RequestBase {
+
+ @SerializedName("statement")
+ private final int statement = 1;
+
+ /**
+ * If set to 1, will return full contracts description.
+ */
+ @SerializedName("description")
+ @Nullable
+ private Integer description;
+
+ /**
+ * Apply upper limit to count of transactions received
+ */
+ @SerializedName("limit")
+ @Nullable
+ private Integer limit;
+
+ /**
+ * Skip this many transactions
+ */
+ @SerializedName("offset")
+ @Nullable
+ private Integer offset;
+
+ /**
+ * Optional start date (epoch)
+ */
+ @SerializedName("date_from")
+ @Nullable
+ private Integer dateFrom;
+
+ /**
+ * Optional end date (epoch)
+ */
+ @SerializedName("date_end")
+ @Nullable
+ private Integer dateEnd;
+
+ /**
+ * Optional filter for statement (deposit,withdrawal,buy,sell)
+ */
+ @SerializedName("action_type")
+ @Nullable
+ private String actionType;
+
+ public StatementRequest() {
+ this.responseType = StatementResponse.class;
+ }
+
+ public boolean getDescription() {
+ return description == 1 ? true : false;
+ }
+
+ public void setDescription(boolean description) {
+ this.description = description ? 1 : 0;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public Integer getOffset() {
+ return offset;
+ }
+
+ public void setOffset(Integer offset) {
+ Validator.checkPattern("^\\d{1,3}$", offset.toString(),
+ "Offset does not match the regex pattern /^\\d{1,3}/");
+ this.offset = offset;
+ }
+
+ public Integer getDateFrom() {
+ return dateFrom;
+ }
+
+ public void setDateFrom(Integer dateFrom) {
+ Validator.checkPattern("^\\d{1,10}$", dateFrom.toString(),
+ "DateFrom does not match the regex pattern /^\\d{1,10}/");
+ this.dateFrom = dateFrom;
+ }
+
+ public Integer getDateEnd() {
+ return dateEnd;
+ }
+
+ public void setDateEnd(Integer dateEnd) {
+ Validator.checkPattern("^\\d{1,10}$", dateEnd.toString(),
+ "DateEnd does not match the regex pattern /^\\d{1,10}/");
+ this.dateEnd = dateEnd;
+ }
+
+ public String getActionType() {
+ return actionType;
+ }
+
+ public void setActionType(TransactionType actionType) {
+ this.actionType = actionType.toString();
+ }
+}
\ No newline at end of file
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/StatesListRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/StatesListRequest.java
new file mode 100644
index 0000000..62a437e
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/StatesListRequest.java
@@ -0,0 +1,39 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.StatesListResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * StatesListRequest
+ *
+ * States List Send
+ * For a given country, returns a list of States of that country. This is useful to populate the account opening form.
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/2/2017
+ */
+public class StatesListRequest extends RequestBase {
+
+ /**
+ * Two letter country code.
+ */
+ @SerializedName("states_list")
+ private String countyCode;
+
+ public StatesListRequest(String countyCode) {
+ this.responseType = StatesListResponse.class;
+ this.setCountyCode(countyCode);
+ }
+
+ public String getCountyCode() {
+ return countyCode;
+ }
+
+ public void setCountyCode(String countyCode) {
+ Validator.checkPattern("^\\w\\w$", countyCode,
+ "Country Code does not match the regex pattern /^\\w\\w$/");
+ this.countyCode = countyCode;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/StopCopyTradeRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/StopCopyTradeRequest.java
new file mode 100644
index 0000000..5b44283
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/StopCopyTradeRequest.java
@@ -0,0 +1,45 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.StopCopyTradeResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * StopCopyTradeRequest
+ *
+ * Copy Stop Send
+ *
+ * Stop copy trader bets
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class StopCopyTradeRequest extends RequestBase {
+
+ /**
+ * API tokens identifying the accounts which needs not to be copied
+ */
+ @SerializedName("copy_stop")
+ private String traderToken;
+
+ private StopCopyTradeRequest(){
+ this.responseType = StopCopyTradeResponse.class;
+ }
+
+ public StopCopyTradeRequest(String traderToken) {
+ this();
+ this.setTraderToken(traderToken);
+ }
+
+ public String getTraderToken() {
+ return traderToken;
+ }
+
+ public void setTraderToken(String traderToken) {
+ Validator.checkPattern("^[\\w\\s-]{15,32}$", traderToken,
+ "Trader Token does not match the regex pattern /^[\\w\\s-]{15,32}$/");
+ this.traderToken = traderToken;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TNCApprovalRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TNCApprovalRequest.java
new file mode 100644
index 0000000..4b7f787
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TNCApprovalRequest.java
@@ -0,0 +1,37 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TNCApprovalResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TNCApprovalRequest
+ *
+ * T&C Approval Send
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/4/2017
+ */
+public class TNCApprovalRequest extends RequestBase {
+
+ @SerializedName("tnc_approval")
+ private final int tcApproval = 1;
+
+ /**
+ * for ASK_UK_FUNDS_PROTECTION in cashier
+ */
+ @SerializedName("ukgc_funds_protection")
+ private Integer askUKFundsProtection;
+
+ public TNCApprovalRequest() {
+ this.responseType = TNCApprovalResponse.class;
+ }
+
+ public Integer getAskUKFundsProtection() {
+ return askUKFundsProtection;
+ }
+
+ public void setAskUKFundsProtection(Integer askUKFundsProtection) {
+ this.askUKFundsProtection = askUKFundsProtection;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TickHistoryRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TickHistoryRequest.java
new file mode 100644
index 0000000..8ca693f
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TickHistoryRequest.java
@@ -0,0 +1,157 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.enums.TickStyles;
+import com.suneesh.trading.models.responses.TickHistoryResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * TickHistoryRequest
+ *
+ * Tick History Request
+ * Get historic tick data for a given symbol name
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class TickHistoryRequest extends RequestBase {
+
+ /**
+ * Short symbol name
+ */
+ @SerializedName("ticks_history")
+ private String symbol;
+
+ /**
+ * Epoch value representing the end-datetime of the ticks.
+ * If non-numeric value (e.g. "latest", the end-datetime will be the latest available timestamp.
+ */
+ @SerializedName("end")
+ private String end;
+
+ /**
+ * Epoch value representing the start-datetime of the ticks (For styles: 'ticks', it will default to 1 day ago.
+ * For styles: 'candle', it will default to 1 day ago if count or granularity is undef )
+ */
+ @SerializedName("start")
+ @Nullable
+ private Integer start;
+
+ /**
+ * An upper limit on ticks to receive (default: 5000)
+ */
+ @SerializedName("count")
+ @Nullable
+ private Integer count;
+
+ /**
+ * The tick-output style: must be one of 'ticks' or 'candles' (default: 'ticks')
+ */
+ @SerializedName("style")
+ @Nullable
+ private String style;
+
+ /**
+ * Provide for style: 'candles'. Candle time-dimension width setting.
+ * Allowed values 60, 120, 180, 300, 600, 900, 1800, 3600, 7200, 14400, 28800, 86400 (default: '60').
+ */
+ @SerializedName("granularity")
+ @Nullable
+ private Integer granularity;
+
+ /**
+ * If market is closed at the end time, or license limit is before end time, then move interval backwards.
+ */
+ @SerializedName("adjust_start_time")
+ @Nullable
+ private Integer adjustStartTime;
+
+ /**
+ * If set to 1, will send updates whenever the price changes
+ */
+ @SerializedName("subscribe")
+ @Nullable
+ private Integer subscribe;
+
+ public TickHistoryRequest(String symbol, String end){
+ this.responseType = TickHistoryResponse.class;
+ this.setSymbol(symbol);
+ this.setEnd(end);
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ Validator.checkPattern("^\\w{2,30}$", symbol,
+ "Symbol does not match the regex pattern /^\\w{2,30}$/");
+ this.symbol = symbol;
+ }
+
+ public String getEnd() {
+ return end;
+ }
+
+ public void setEnd(String end) {
+ Validator.checkPattern("^(latest|\\d{1,10})$", end,
+ "End does not match the regex pattern /^(latest|\\d{1,10})$/");
+ this.end = end;
+ }
+
+ public Integer getStart() {
+ return start;
+ }
+
+ public void setStart(Integer start) {
+ Validator.checkPattern("^\\d{1,10}$", start.toString(),
+ "Start does not match the regex pattern /^\\d{1,10}$/");
+ this.start = start;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public void setStyle(TickStyles style) {
+ this.style = style.toString().toLowerCase();
+ }
+
+ public Integer getGranularity() {
+ return granularity;
+ }
+
+ public void setGranularity(Integer granularity) {
+ this.granularity = granularity;
+ }
+
+ public Integer getAdjustStartTime() {
+ return adjustStartTime;
+ }
+
+ public void setAdjustStartTime(Integer adjustStartTime) {
+ Validator.checkPattern("^1?$", adjustStartTime.toString(),
+ "AdjustStartTime does not match the regex /^1?$/");
+ this.adjustStartTime = adjustStartTime;
+ }
+
+ public Integer getSubscribe() {
+ return subscribe;
+ }
+
+ public void setSubscribe(Integer subscribe) {
+ Validator.checkPattern("^1?$", subscribe.toString(),
+ "Subscribe does not match the regex /^1?$/");
+ this.subscribe = subscribe;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TickRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TickRequest.java
new file mode 100644
index 0000000..6c625ad
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TickRequest.java
@@ -0,0 +1,52 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TickResponse;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * Created by morteza on 7/19/2017.
+ */
+
+public class TickRequest extends RequestBase{
+
+ public TickRequest(){
+ this.responseType = TickResponse.class;
+ }
+
+ public TickRequest(String symbol) {
+ this();
+ this.symbol = symbol;
+ }
+
+ public TickRequest(String symbol, Boolean subscribe){
+ this(symbol);
+ this.subscribe = subscribe? 1: null;
+ }
+
+ @SerializedName("ticks")
+ private String symbol;
+
+ /**
+ * If set to 1, will send updates whenever the price changes
+ */
+ @SerializedName("subscribe")
+ @Nullable
+ private Integer subscribe = null;
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public Integer getSubscribe() {
+ return subscribe;
+ }
+
+ public void setSubscribe(Integer subscribe) {
+ this.subscribe = subscribe;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TimeRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TimeRequest.java
new file mode 100644
index 0000000..38f7dcd
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TimeRequest.java
@@ -0,0 +1,24 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TimeResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TimeRequest
+ *
+ * Time request
+ * Request back-end server epoch time
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class TimeRequest extends RequestBase {
+
+ @SerializedName("time")
+ private final int time = 1;
+
+ public TimeRequest() {
+ this.responseType = TimeResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TopUpVirtualMoneyAccountRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TopUpVirtualMoneyAccountRequest.java
new file mode 100644
index 0000000..d1a193b
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TopUpVirtualMoneyAccountRequest.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TopUpVirtualMoneyAccountResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TopUpVirtualMoneyAccountRequest
+ *
+ * Top Up Virtual Request
+ *
+ * When a virtual-money's account balance becomes low, it can be topped up using this call.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class TopUpVirtualMoneyAccountRequest extends RequestBase {
+
+ @SerializedName("topup_virtual")
+ private final int topUpVirtual = 1;
+
+ public TopUpVirtualMoneyAccountRequest() {
+ this.responseType = TopUpVirtualMoneyAccountResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TradingTimesRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TradingTimesRequest.java
new file mode 100644
index 0000000..c97aadf
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TradingTimesRequest.java
@@ -0,0 +1,43 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TradingTimesResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TradingTimesRequest
+ *
+ * Trading Times Send
+ * Receive a list of marketing opening times for a given date
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class TradingTimesRequest extends RequestBase {
+
+ /**
+ * Trading date in yyyy-mm-dd format (or use 'today' for trading times for today's date).
+ */
+ @SerializedName("trading_times")
+ private String tradingDate;
+
+ public TradingTimesRequest() {
+ this.setResponseType(TradingTimesResponse.class);
+ }
+
+ public TradingTimesRequest(String tradingDate) {
+ this();
+ this.setTradingDate(tradingDate);
+ }
+
+ public String getTradingDate() {
+ return tradingDate;
+ }
+
+ public void setTradingDate(String tradingDate) {
+ Validator.checkPattern("^(\\d{4}-\\d{1,2}-\\d{1,2}|today)$", tradingDate,
+ "Trading Date does not match the regex pattern /^(\\d{4}-\\d{1,2}-\\d{1,2}|today)$/");
+ this.tradingDate = tradingDate;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TransactionsStreamRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TransactionsStreamRequest.java
new file mode 100644
index 0000000..ee60b4d
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TransactionsStreamRequest.java
@@ -0,0 +1,29 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TransactionsStreamResponse;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * TransactionsStreamRequest
+ *
+ * Transaction Subscription
+ *
+ * Subscribe to transaction notifications
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class TransactionsStreamRequest extends RequestBase {
+
+ @SerializedName("transaction")
+ private final int transaction = 1;
+
+ @SerializedName("subscribe")
+ private final int subscribe = 1;
+
+ public TransactionsStreamRequest() {
+ this.responseType = TransactionsStreamResponse.class;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/TransferBetweenAccountsRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/TransferBetweenAccountsRequest.java
new file mode 100644
index 0000000..a3ccc18
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/TransferBetweenAccountsRequest.java
@@ -0,0 +1,88 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.TransferBetweenAccountsResponse;
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * TransferBetweenAccountsRequest
+ *
+ * Transfer Between Accounts Request
+ *
+ * This call allows transfers between accounts held by a given user with the 'malta' and
+ * 'maltainvest' Landing Companies or between sub account and master account for omnibus accounts.
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/15/2017
+ */
+public class TransferBetweenAccountsRequest extends RequestBase {
+
+ /**
+ * if account_from and account_to are not provided, we'll just return available accounts
+ */
+ @SerializedName("transfer_between_accounts")
+ private final int transferBetweenAccounts = 1;
+
+ /**
+ * The account_from loginid
+ */
+ @SerializedName("account_from")
+ private String accountFrom;
+
+ /**
+ * The account_to loginid
+ */
+ @SerializedName("account_to")
+ private String accountTo;
+
+ /**
+ * Currency
+ */
+ @SerializedName("currency")
+ private String currency;
+
+ /**
+ * Amount
+ */
+ @SerializedName("amount")
+ private BigDecimal amount;
+
+ public TransferBetweenAccountsRequest() {
+ this.responseType = TransferBetweenAccountsResponse.class;
+ }
+
+ public String getAccountFrom() {
+ return accountFrom;
+ }
+
+ public void setAccountFrom(String accountFrom) {
+ this.accountFrom = accountFrom;
+ }
+
+ public String getAccountTo() {
+ return accountTo;
+ }
+
+ public void setAccountTo(String accountTo) {
+ this.accountTo = accountTo;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ public void setAmount(BigDecimal amount) {
+ this.amount = amount;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/requests/WebsiteStatusRequest.java b/Trading/src/main/java/com/suneesh/trading/models/requests/WebsiteStatusRequest.java
new file mode 100644
index 0000000..b56183f
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/requests/WebsiteStatusRequest.java
@@ -0,0 +1,45 @@
+package com.suneesh.trading.models.requests;
+
+import com.suneesh.trading.models.responses.WebsiteStatusResponse;
+import com.suneesh.trading.utils.Validator;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+import okhttp3.WebSocket;
+
+/**
+ * WebsiteStatusRequest
+ *
+ * Server Status request
+ * Request server status
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class WebsiteStatusRequest extends RequestBase {
+
+ @SerializedName("website_status")
+ private final int websiteStatus = 1;
+
+ @SerializedName("subscribe")
+ @Nullable
+ private Integer subscribe;
+
+ public WebsiteStatusRequest() {
+ this.responseType = WebsiteStatusResponse.class;
+ }
+
+ public WebsiteStatusRequest(Integer subscribe){
+ this();
+ }
+
+ public Integer getSubscribe() {
+ return subscribe;
+ }
+
+ public void setSubscribe(Integer subscribe) {
+ Validator.checkPattern("^(1|0)$", subscribe.toString(),
+ "Subscribe does not match the regex pattern /^(1|0)$/");
+ this.subscribe = subscribe;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimits.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimits.java
new file mode 100644
index 0000000..9c76708
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimits.java
@@ -0,0 +1,136 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class AccountLimits {
+
+ /**
+ * Maximum account cash balance
+ */
+ @SerializedName("account_balance")
+ private BigDecimal accountBalance;
+
+ /**
+ * Maximum daily turnover
+ */
+ @SerializedName("daily_turnover")
+ private BigDecimal dailyTurnover;
+
+ /**
+ * Maximum number of open positions
+ */
+ @SerializedName("open_positions")
+ private int openPositions;
+
+ /**
+ * Maximum aggregate payouts on open positions
+ */
+ @SerializedName("payout")
+ private BigDecimal payout;
+
+ /**
+ * Maximum aggregate payouts on open positions per symbol and contract type.
+ * This limit can be exceeded up to the overall payout limit if there is no prior open position.
+ */
+ @SerializedName("payout_per_symbol_and_contract_type")
+ private BigDecimal payoutPerSymbolAndContractType;
+
+ /**
+ * Lifetime withdrawal limit
+ */
+ @SerializedName("lifetime_limit")
+ private BigDecimal lifetimeLimit;
+
+ /**
+ * Number of days for num_of_days_limit withdrawal limit
+ */
+ @SerializedName("num_of_days")
+ private int numOfDays;
+
+ /**
+ * Withdrawal limit for num_of_days days
+ */
+ @SerializedName("num_of_days_limit")
+ private int numOfDaysLimit;
+
+ /**
+ * Amount left to reach withdrawal limit
+ */
+ @SerializedName("remainder")
+ private BigDecimal remainder;
+
+ /**
+ * Total withdrawal for num_of_days days
+ */
+ @SerializedName("withdrawal_for_x_days_monetary")
+ private BigDecimal withdrawalForXDaysMonetary;
+
+ /**
+ * Total withdrawal since inception
+ */
+ @SerializedName("withdrawal_since_inception_monetary")
+ private BigDecimal withdrawalSinceInceptionMonetary;
+
+ /**
+ * Markets Limits
+ */
+ @SerializedName("market_specific")
+ private Map> marketSpecific;
+
+ public BigDecimal getAccountBalance() {
+ return accountBalance;
+ }
+
+ public BigDecimal getDailyTurnover() {
+ return dailyTurnover;
+ }
+
+ public int getOpenPositions() {
+ return openPositions;
+ }
+
+ public BigDecimal getPayout() {
+ return payout;
+ }
+
+ public BigDecimal getPayoutPerSymbolAndContractType() {
+ return payoutPerSymbolAndContractType;
+ }
+
+ public BigDecimal getLifetimeLimit() {
+ return lifetimeLimit;
+ }
+
+ public int getNumOfDays() {
+ return numOfDays;
+ }
+
+ public int getNumOfDaysLimit() {
+ return numOfDaysLimit;
+ }
+
+ public BigDecimal getRemainder() {
+ return remainder;
+ }
+
+ public BigDecimal getWithdrawalForXDaysMonetary() {
+ return withdrawalForXDaysMonetary;
+ }
+
+ public BigDecimal getWithdrawalSinceInceptionMonetary() {
+ return withdrawalSinceInceptionMonetary;
+ }
+
+ public Map> getMarketSpecific() {
+ return marketSpecific;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimitsResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimitsResponse.java
new file mode 100644
index 0000000..a11cf2a
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountLimitsResponse.java
@@ -0,0 +1,27 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.AccountLimitsRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * AccountLimitResponse
+ *
+ * Get Limits Receive
+ * Trading and Withdrawal Limits
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class AccountLimitsResponse extends ResponseBase {
+
+ /**
+ * Trading limits of real account user
+ */
+ @SerializedName("get_limits")
+ private AccountLimits limits;
+
+ public AccountLimits getLimits() {
+ return limits;
+ }
+}
\ No newline at end of file
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettings.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettings.java
new file mode 100644
index 0000000..2c12c32
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettings.java
@@ -0,0 +1,357 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * AccountSettings
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+public class AccountSettings {
+
+ /**
+ * User Email
+ */
+ @SerializedName("email")
+ private String email;
+
+ /**
+ * User Country
+ */
+ @SerializedName("country")
+ @Nullable
+ private String country;
+
+ /**
+ * 2-letter country code ISO standard
+ */
+ @SerializedName("country_code")
+ @Nullable
+ private String countryCode;
+
+ /**
+ * Salutation (note: not set for virtual-money accounts)
+ */
+ @SerializedName("salutation")
+ @Nullable
+ private String salutation;
+
+ /**
+ * First name (note: not set for virtual-money accounts)
+ */
+ @SerializedName("first_name")
+ @Nullable
+ private String firstName;
+
+ /**
+ * Last name (note: not set for virtual-money accounts)
+ */
+ @SerializedName("last_name")
+ @Nullable
+ private String lastName;
+
+ /**
+ * Epoch of user's birthday (note: not set for virtual-money accounts)
+ */
+ @SerializedName("date_of_birth")
+ @Nullable
+ private Integer dateOfBirth;
+
+ /**
+ * Address line 1 (note: not set for virtual-money accounts)
+ */
+ @SerializedName("address_line_1")
+ @Nullable
+ private String firstAddressLine;
+
+ /**
+ * Address line 2 (note: not set for virtual-money accounts)
+ */
+ @SerializedName("address_line_2")
+ @Nullable
+ private String secondAddressLine;
+
+ /**
+ * City (note: not set for virtual-money accounts)
+ */
+ @SerializedName("address_city")
+ @Nullable
+ private String addressCity;
+
+ /**
+ * State (note: not set for virtual-money accounts)
+ */
+ @SerializedName("address_state")
+ @Nullable
+ private String addressState;
+
+ /**
+ * Post Code (note: not set for virtual-money accounts)
+ */
+ @SerializedName("address_postcode")
+ @Nullable
+ private String addressPostcode;
+
+ /**
+ * Telephone (note: not set for virtual-money accounts)
+ */
+ @SerializedName("phone")
+ @Nullable
+ private String phone;
+
+ /**
+ * Boolean value 1 or 0, indicating whether is payment agent (note: not applicable for virtual money accounts)
+ */
+ @SerializedName("is_authenticated_payment_agent")
+ private int isAuthenticatedPaymentAgent;
+
+ /**
+ * Boolean value 1 or 0, indicating permission to use email address for any contact which may include marketing
+ */
+ @SerializedName("email_consent")
+ private int emailConsent;
+
+ /**
+ * Boolean value 1 or 0, indicating permission to allow others to follow your trades.
+ * Note: not applicable for Virtual account. Only allow for real money account.
+ */
+ @SerializedName("allow_copier")
+ private int allowCopier;
+
+ /**
+ * Latest terms and conditions version accepted by client
+ */
+ @SerializedName("client_tnc_status")
+ @Nullable
+ private String clientTNCStatus;
+
+ /**
+ * Place of birth, 2-letter country code.
+ */
+ @SerializedName("place_of_birth")
+ @Nullable
+ private String placeOfBirth;
+
+ /**
+ * Residence for tax purpose. Comma separated iso country code if multiple jurisdictions.
+ * Only applicable for real money account.
+ */
+ @SerializedName("tax_residence")
+ @Nullable
+ private String taxResidence;
+
+ /**
+ * Tax identification number. Only applicable for real money account.
+ */
+ @SerializedName("tax_identification_number")
+ @Nullable
+ private String taxIdentificationNumber;
+
+ /**
+ * Purpose and reason for requesting the account opening. Only applicable for real money account.
+ */
+ @SerializedName("account_opening_reason")
+ @Nullable
+ private String accountOpeningReason;
+
+ /**
+ * Japan real money account status, only applicable for Japan virtual money account client.
+ */
+ @SerializedName("jp_account_status")
+ @Nullable
+ private JPAccountStatus jpAccountStatus;
+
+ /**
+ * Japan real money client settings, only applicable for Japan real money account client.
+ */
+ @SerializedName("jp_settings")
+ @Nullable
+ private JPSettings jpSettings;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ public void setCountryCode(String countryCode) {
+ this.countryCode = countryCode;
+ }
+
+ public String getSalutation() {
+ return salutation;
+ }
+
+ public void setSalutation(String salutation) {
+ this.salutation = salutation;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public Integer getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ public void setDateOfBirth(Integer dateOfBirth) {
+ this.dateOfBirth = dateOfBirth;
+ }
+
+ public String getFirstAddressLine() {
+ return firstAddressLine;
+ }
+
+ public void setFirstAddressLine(String firstAddressLine) {
+ this.firstAddressLine = firstAddressLine;
+ }
+
+ public String getSecondAddressLine() {
+ return secondAddressLine;
+ }
+
+ public void setSecondAddressLine(String secondAddressLine) {
+ this.secondAddressLine = secondAddressLine;
+ }
+
+ public String getAddressCity() {
+ return addressCity;
+ }
+
+ public void setAddressCity(String addressCity) {
+ this.addressCity = addressCity;
+ }
+
+ public String getAddressState() {
+ return addressState;
+ }
+
+ public void setAddressState(String addressState) {
+ this.addressState = addressState;
+ }
+
+ public String getAddressPostcode() {
+ return addressPostcode;
+ }
+
+ public void setAddressPostcode(String addressPostcode) {
+ this.addressPostcode = addressPostcode;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public boolean isAuthenticatedPaymentAgent() {
+ return isAuthenticatedPaymentAgent == 1 ? true : false;
+ }
+
+ public void setIsAuthenticatedPaymentAgent(boolean isAuthenticatedPaymentAgent) {
+ this.isAuthenticatedPaymentAgent = isAuthenticatedPaymentAgent ? 1 : 0;
+ }
+
+ public boolean getEmailConsent() {
+ return emailConsent == 1 ? true : false;
+ }
+
+ public void setEmailConsent(boolean emailConsent) {
+ this.emailConsent = emailConsent ? 1 : 0;
+ }
+
+ public boolean getAllowCopier() {
+ return allowCopier == 1 ? true : false;
+ }
+
+ public void setAllowCopier(boolean allowCopier) {
+ this.allowCopier = allowCopier ? 1 : 0;
+ }
+
+ public String getClientTNCStatus() {
+ return clientTNCStatus;
+ }
+
+ public void setClientTNCStatus(String clientTNCStatus) {
+ this.clientTNCStatus = clientTNCStatus;
+ }
+
+ public String getPlaceOfBirth() {
+ return placeOfBirth;
+ }
+
+ public void setPlaceOfBirth(String placeOfBirth) {
+ this.placeOfBirth = placeOfBirth;
+ }
+
+ public String getTaxResidence() {
+ return taxResidence;
+ }
+
+ public void setTaxResidence(String taxResidence) {
+ this.taxResidence = taxResidence;
+ }
+
+ public String getTaxIdentificationNumber() {
+ return taxIdentificationNumber;
+ }
+
+ public void setTaxIdentificationNumber(String taxIdentificationNumber) {
+ this.taxIdentificationNumber = taxIdentificationNumber;
+ }
+
+ public String getAccountOpeningReason() {
+ return accountOpeningReason;
+ }
+
+ public void setAccountOpeningReason(String accountOpeningReason) {
+ this.accountOpeningReason = accountOpeningReason;
+ }
+
+ public JPAccountStatus getJpAccountStatus() {
+ return jpAccountStatus;
+ }
+
+ public void setJpAccountStatus(JPAccountStatus jpAccountStatus) {
+ this.jpAccountStatus = jpAccountStatus;
+ }
+
+ public JPSettings getJpSettings() {
+ return jpSettings;
+ }
+
+ public void setJpSettings(JPSettings jpSettings) {
+ this.jpSettings = jpSettings;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettingsResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettingsResponse.java
new file mode 100644
index 0000000..dfa0eac
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountSettingsResponse.java
@@ -0,0 +1,27 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.AccountSettingsRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * AccountSettingsResponse
+ *
+ *
Get User Settings Receive
+ * A message with User Settings
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+public class AccountSettingsResponse extends ResponseBase {
+
+ /**
+ * Account settings
+ */
+ @SerializedName("get_settings")
+ private AccountSettings settings;
+
+ public AccountSettings getSettings() {
+ return settings;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatus.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatus.java
new file mode 100644
index 0000000..2372d16
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatus.java
@@ -0,0 +1,53 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.List;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+@Entity
+@Data
+public class AccountStatus {
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long identifier;
+
+ /**
+ * Array of Status
+ */
+ @SerializedName("status")
+// private List status;
+ private String status;
+
+ /**
+ * Indicates whether the client should be prompted to authenticate their account.
+ */
+ @SerializedName("prompt_client_to_authenticate")
+ private int promptClientToAuthenticate;
+
+ /**
+ * Client risk classification: low, standard, high
+ */
+ @SerializedName("risk_classification")
+ private String riskClassification;
+
+// public List getStatus() {
+ public String getStatus() {
+ return String.join(",", status);
+// status;
+ }
+
+ public boolean getPromptClientToAuthenticate() {
+ return promptClientToAuthenticate == 1 ? true : false;
+ }
+
+ public String getRiskClassification() {
+ return riskClassification;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatusResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatusResponse.java
new file mode 100644
index 0000000..2a19598
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AccountStatusResponse.java
@@ -0,0 +1,31 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.AccountStatusRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * AccountStatusResponse
+ *
+ * Get Account Status Receive
+ * A message with Account Status
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+public class AccountStatusResponse extends ResponseBase {
+
+ public void setAccountStatus(AccountStatus accountStatus) {
+ this.accountStatus = accountStatus;
+ }
+
+ /**
+ * Account status details
+ */
+ @SerializedName("get_account_status")
+ private AccountStatus accountStatus;
+
+ public AccountStatus getAccountStatus() {
+ return accountStatus;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbol.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbol.java
new file mode 100644
index 0000000..e2e5e64
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbol.java
@@ -0,0 +1,357 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 7/31/2017
+ */
+public class ActiveSymbol {
+ /**
+ * intraday_interval_minutes
+ */
+ @SerializedName("symbol")
+ private String symbol;
+
+ /**
+ * Intraday interval minutes
+ */
+ @SerializedName("intraday_interval_minutes")
+ private int intradayIntervalMinutes;
+
+ /**
+ * Symbol type (forex, commodities, etc)
+ */
+ @SerializedName("symbol_type")
+ private String symbolType;
+
+ /**
+ * 1 or 0 - whether the market is currently open or closed
+ */
+ @SerializedName("exchange_is_open")
+ @Nullable
+ private Integer isExhcangeOpen;
+
+ /**
+ * Exchange name (for underlyings listed on a Stock Exchange)
+ */
+ @SerializedName("exchange_name")
+ private String exchangeName;
+
+ /**
+ * Exchange name (for underlyings listed on a Stock Exchange)
+ */
+ @SerializedName("delay_amount")
+ private int delayAmount;
+
+ /**
+ * Display name
+ */
+ @SerializedName("display_name")
+ private String displayName;
+
+ /**
+ * Latest spot price of the underlying
+ */
+ @SerializedName("spot")
+ @Nullable
+ private Integer spot;
+
+ /**
+ * Latest spot epoch time
+ */
+ @SerializedName("spot_time")
+ private String spotTime;
+
+ /**
+ * 1 indicates that trading is currently suspended
+ */
+ @SerializedName("is_trading_suspended")
+ @Nullable
+ private Integer isTradingSuspended;
+
+ /**
+ * For stocks and stock indices, the underlying currency for that instrument
+ */
+ @SerializedName("quoted_currency_symbole")
+ private String quotedCurrencySymbol;
+
+ /**
+ * Number of seconds elapsed since the last spot price
+ */
+ @SerializedName("spot_age")
+ private String spotAge;
+
+ /**
+ * Market category (forex, indices etc)
+ */
+ @SerializedName("market")
+ private String market;
+
+ /**
+ * Translated market name
+ */
+ @SerializedName("market_display_name")
+ private String marketDisplayName;
+
+ /**
+ * Submarket name
+ */
+ @SerializedName("submarket")
+ private String subMarket;
+
+ /**
+ * Translated submarket name
+ */
+ @SerializedName("submarket_display_name")
+ private String subMarketDisplayName;
+
+ /**
+ * Pip size (i.e. minimum fluctuation amount)
+ */
+ @SerializedName("pip")
+ private BigDecimal pip;
+
+ /**
+ * {@link ActiveSymbol#symbol}
+ */
+ public String getSymbol() {
+
+ return symbol;
+ }
+
+ /**
+ * {@link ActiveSymbol#symbol}
+ */
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ /**
+ * {@link ActiveSymbol#intradayIntervalMinutes}
+ */
+ public int getIntradayIntervalMinutes() {
+ return intradayIntervalMinutes;
+ }
+
+ /**
+ * {@link ActiveSymbol#intradayIntervalMinutes}
+ */
+ public void setIntradayIntervalMinutes(int intradayIntervalMinutes) {
+ this.intradayIntervalMinutes = intradayIntervalMinutes;
+ }
+
+ /**
+ * {@link ActiveSymbol#symbolType}
+ */
+ public String getSymbolType() {
+ return symbolType;
+ }
+
+ /**
+ * {@link ActiveSymbol#symbolType}
+ */
+ public void setSymbolType(String symbolType) {
+ this.symbolType = symbolType;
+ }
+
+ /**
+ * {@link ActiveSymbol#isExhcangeOpen}
+ */
+ public Integer getIsExhcangeOpen() {
+ return isExhcangeOpen;
+ }
+
+ /**
+ * {@link ActiveSymbol#isExhcangeOpen}
+ */
+ public void setIsExhcangeOpen(Integer isExhcangeOpen) {
+ this.isExhcangeOpen = isExhcangeOpen;
+ }
+
+ /**
+ * {@link ActiveSymbol#exchangeName}
+ */
+ public String getExchangeName() {
+ return exchangeName;
+ }
+
+ /**
+ * {@link ActiveSymbol#exchangeName}
+ */
+ public void setExchangeName(String exchangeName) {
+ this.exchangeName = exchangeName;
+ }
+
+ /**
+ * {@link ActiveSymbol#delayAmount}
+ */
+ public int getDelayAmount() {
+ return delayAmount;
+ }
+
+ /**
+ * {@link ActiveSymbol#delayAmount}
+ */
+ public void setDelayAmount(int delayAmount) {
+ this.delayAmount = delayAmount;
+ }
+
+ /**
+ * {@link ActiveSymbol#displayName}
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#displayName}
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#spot}
+ */
+ public Integer getSpot() {
+ return spot;
+ }
+
+ /**
+ * {@link ActiveSymbol#spot}
+ */
+ public void setSpot(Integer spot) {
+ this.spot = spot;
+ }
+
+ /**
+ * {@link ActiveSymbol#spotTime}
+ */
+ public String getSpotTime() {
+ return spotTime;
+ }
+
+ /**
+ * {@link ActiveSymbol#spotTime}
+ */
+ public void setSpotTime(String spotTime) {
+ this.spotTime = spotTime;
+ }
+
+ /**
+ * {@link ActiveSymbol#isTradingSuspended}
+ */
+ public Integer getIsTradingSuspended() {
+ return isTradingSuspended;
+ }
+
+ /**
+ * {@link ActiveSymbol#isTradingSuspended}
+ */
+ public void setIsTradingSuspended(Integer isTradingSuspended) {
+ this.isTradingSuspended = isTradingSuspended;
+ }
+
+ /**
+ * {@link ActiveSymbol#quotedCurrencySymbol}
+ */
+ public String getQuotedCurrencySymbol() {
+ return quotedCurrencySymbol;
+ }
+
+ /**
+ * {@link ActiveSymbol#quotedCurrencySymbol}
+ */
+ public void setQuotedCurrencySymbol(String quotedCurrencySymbol) {
+ this.quotedCurrencySymbol = quotedCurrencySymbol;
+ }
+
+ /**
+ * {@link ActiveSymbol#spotAge}
+ */
+ public String getSpotAge() {
+ return spotAge;
+ }
+
+ /**
+ * {@link ActiveSymbol#spotAge}
+ */
+ public void setSpotAge(String spotAge) {
+ this.spotAge = spotAge;
+ }
+
+ /**
+ * {@link ActiveSymbol#market}
+ */
+ public String getMarket() {
+ return market;
+ }
+
+ /**
+ * {@link ActiveSymbol#market}
+ */
+ public void setMarket(String market) {
+ this.market = market;
+ }
+
+ /**
+ * {@link ActiveSymbol#marketDisplayName}
+ */
+ public String getMarketDisplayName() {
+ return marketDisplayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#marketDisplayName}
+ */
+ public void setMarketDisplayName(String marketDisplayName) {
+ this.marketDisplayName = marketDisplayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#subMarket}
+ */
+ public String getSubMarket() {
+ return subMarket;
+ }
+
+ /**
+ * {@link ActiveSymbol#subMarket}
+ */
+ public void setSubMarket(String subMarket) {
+ this.subMarket = subMarket;
+ }
+
+ /**
+ * {@link ActiveSymbol#subMarketDisplayName}
+ */
+ public String getSubMarketDisplayName() {
+ return subMarketDisplayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#subMarketDisplayName}
+ */
+ public void setSubMarketDisplayName(String subMarketDisplayName) {
+ this.subMarketDisplayName = subMarketDisplayName;
+ }
+
+ /**
+ * {@link ActiveSymbol#pip}
+ */
+ public BigDecimal getPip() {
+ return pip;
+ }
+
+ /**
+ * {@link ActiveSymbol#pip}
+ */
+ public void setPip(BigDecimal pip) {
+ this.pip = pip;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbolResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbolResponse.java
new file mode 100644
index 0000000..d96e36f
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ActiveSymbolResponse.java
@@ -0,0 +1,38 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ActiveSymbolRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * ActiveSymbolResponse
+ *
+ * Get list of active symbols Receive
+ * A message list of active symbols
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 7/31/2017
+ */
+public class ActiveSymbolResponse extends ResponseBase {
+
+ /**
+ * List of active symbols. Note: if the user is authenticated,
+ * then only symbols allowed under his account will be returned.
+ */
+ @SerializedName("active_symbols")
+ private ActiveSymbol[] activeSymbols;
+
+ /**
+ * {@link ActiveSymbolResponse#activeSymbols}
+ */
+ public ActiveSymbol[] getActiveSymbols() {
+ return activeSymbols;
+ }
+
+ /**
+ * {@link ActiveSymbolResponse#activeSymbols}
+ */
+ public void setActiveSymbols(ActiveSymbol[] activeSymbols) {
+ this.activeSymbols = activeSymbols;
+ }
+}
+
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApiCallLimit.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiCallLimit.java
new file mode 100644
index 0000000..28645f1
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiCallLimit.java
@@ -0,0 +1,42 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+public class ApiCallLimit {
+
+ @SerializedName("applies_to")
+ private String appliesTo;
+
+ @SerializedName("max")
+ @Nullable
+ private Integer max;
+
+ @SerializedName("hourly")
+ @Nullable
+ private Integer hourly;
+
+ @SerializedName("minutely")
+ private String minutely;
+
+ public String getAppliesTo() {
+ return appliesTo;
+ }
+
+ public Integer getMax() {
+ return max;
+ }
+
+ public Integer getHourly() {
+ return hourly;
+ }
+
+ public String getMinutely() {
+ return minutely;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApiToken.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiToken.java
new file mode 100644
index 0000000..0623c3a
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiToken.java
@@ -0,0 +1,63 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class ApiToken {
+
+ /**
+ * Display name
+ */
+ @SerializedName("display_name")
+ private String displayName;
+
+ /**
+ * Last used
+ */
+ @SerializedName("last_used")
+ private String lastUsed;
+
+ /**
+ * Scopes
+ */
+ @SerializedName("scopes")
+ private List scopes;
+
+ /**
+ * Token
+ */
+ @SerializedName("token")
+ private String Token;
+
+ /**
+ * Validated IP(s) list
+ */
+ @SerializedName("valid_for_ip")
+ private String validForIp;
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getLastUsed() {
+ return lastUsed;
+ }
+
+ public List getScopes() {
+ return scopes;
+ }
+
+ public String getToken() {
+ return Token;
+ }
+
+ public String getValidForIp() {
+ return validForIp;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApiTokenManagementResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiTokenManagementResponse.java
new file mode 100644
index 0000000..7e1e55e
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApiTokenManagementResponse.java
@@ -0,0 +1,68 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApiTokenManagementRequest;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * ApiTokenManagementResponse
+ *
+ * API Token Response
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class ApiTokenManagementResponse extends ResponseBase {
+
+ /**
+ * Api Token
+ */
+ @SerializedName("api_token")
+ private ApiTokenResult apiTokenResult;
+
+ public ApiTokenResult getApiTokenResult() {
+ return apiTokenResult;
+ }
+
+ public class ApiTokenResult {
+
+ /**
+ * API tokens
+ */
+ @SerializedName("tokens")
+ private List tokens;
+
+ /**
+ * Token created.
+ */
+ @SerializedName("new_token")
+ private Integer isTokenCreated;
+
+ /**
+ * Token Deleted
+ */
+ @SerializedName("delete_token")
+ private Integer isTokenDeleted;
+
+ @SerializedName("sub_account")
+ private String subAccount;
+
+ public List getTokens() {
+ return tokens;
+ }
+
+ public boolean isTokenCreated() {
+ return isTokenCreated == 1 ? true : false;
+ }
+
+ public boolean isTokenDeleted() {
+ return isTokenDeleted == 1 ? true : false;
+ }
+
+ public String getSubAccount() {
+ return subAccount;
+ }
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/Application.java b/Trading/src/main/java/com/suneesh/trading/models/responses/Application.java
new file mode 100644
index 0000000..e830d6c
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/Application.java
@@ -0,0 +1,109 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class Application {
+
+ /**
+ * Framework name
+ *
+ */
+ @SerializedName("name")
+ private String name;
+
+ @SerializedName("app_id")
+ private Long applicationId;
+
+ /**
+ * Framework's homepage
+ *
+ */
+ @SerializedName("homepage")
+ private String homepageUrl;
+
+ /**
+ * Framework's GitHub page (for open-source projects)
+ *
+ */
+ @SerializedName("github")
+ private String githubUrl;
+
+ /**
+ * Framework's App Store URL (if applicable)
+ *
+ */
+ @SerializedName("appstore")
+ private String appStoreUrl;
+
+ /**
+ * Framework's Google Play URL (if applicable)
+ *
+ */
+ @SerializedName("googleplay")
+ private String googlePlayUrl;
+
+ /**
+ * Framework redirect_uri
+ *
+ */
+ @SerializedName("redirect_uri")
+ private String redirectUri;
+
+ /**
+ * Framework verification_uri
+ *
+ */
+ @SerializedName("verification_uri")
+ private String verificationUri;
+
+ /**
+ * Markup to be added to contract prices (as a percentage of contract payout). Min: 0, Max: 5
+ *
+ */
+ @SerializedName("app_markup_percentage")
+ private BigDecimal appMarkupPercentage;
+
+ public String getName() {
+ return name;
+ }
+
+ public Long getApplicationId() {
+ return applicationId;
+ }
+
+ public String getHomepageUrl() {
+ return homepageUrl;
+ }
+
+ public String getGithubUrl() {
+ return githubUrl;
+ }
+
+ public String getAppStoreUrl() {
+ return appStoreUrl;
+ }
+
+ public String getGooglePlayUrl() {
+ return googlePlayUrl;
+ }
+
+ public String getRedirectUri() {
+ return redirectUri;
+ }
+
+ public String getVerificationUri() {
+ return verificationUri;
+ }
+
+ public BigDecimal getAppMarkupPercentage() {
+ return appMarkupPercentage;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDeletionResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDeletionResponse.java
new file mode 100644
index 0000000..9f28b8b
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDeletionResponse.java
@@ -0,0 +1,21 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApplicationDeletionRequest;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/20/2017
+ */
+public class ApplicationDeletionResponse extends ResponseBase {
+
+ @SerializedName("app_delete")
+ @Nullable
+ private Integer response;
+
+ public boolean getResponse() {
+ return response == 1 ? true : false;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDetailsResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDetailsResponse.java
new file mode 100644
index 0000000..17eeb35
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationDetailsResponse.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApplicationDetailsRequest;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * ApplicationDetailsResponse
+ *
+ * App Get Receive
+ * A message with requested application
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/27/2017
+ */
+public class ApplicationDetailsResponse extends ResponseBase {
+
+ @SerializedName("app_get")
+ @Nullable
+ private Application application;
+
+ public Application getApplication() {
+ return application;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationListResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationListResponse.java
new file mode 100644
index 0000000..ea9a0f2
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationListResponse.java
@@ -0,0 +1,26 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApplicationListRequest;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * ApplicationListResponse
+ *
+ * App List Receive
+ * A message with created applications
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/24/2017
+ */
+public class ApplicationListResponse extends ResponseBase {
+
+ @SerializedName("app_list")
+ private List applications;
+
+ public List getApplications() {
+ return applications;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationRegistrationResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationRegistrationResponse.java
new file mode 100644
index 0000000..e4bf2a9
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationRegistrationResponse.java
@@ -0,0 +1,19 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApplicationRegistrationRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/9/2017
+ */
+public class ApplicationRegistrationResponse extends ResponseBase {
+
+ @SerializedName("app_register")
+ private Application registeredApplication;
+
+ public Application getRegisteredApplication() {
+ return registeredApplication;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationUpdateResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationUpdateResponse.java
new file mode 100644
index 0000000..ccf7fc0
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/ApplicationUpdateResponse.java
@@ -0,0 +1,21 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.ApplicationUpdateRequest;
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/27/2017
+ */
+public class ApplicationUpdateResponse extends ResponseBase {
+
+ @SerializedName("app_update")
+ @Nullable
+ private Application application;
+
+ public Application getApplication() {
+ return application;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndex.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndex.java
new file mode 100644
index 0000000..6a1bc81
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndex.java
@@ -0,0 +1,41 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 7/31/2017
+ */
+public class AssetIndex {
+ private String symbol;
+ private String symbolDisplayName;
+ List contracts = new ArrayList<>();
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getSymbolDisplayName() {
+ return symbolDisplayName;
+ }
+
+ public void setSymbolDisplayName(String symbolDisplayName) {
+ this.symbolDisplayName = symbolDisplayName;
+ }
+
+ public void addContract(ContractInfo contract) {
+ this.contracts.add(contract);
+ }
+
+ public List getContracts() {
+ return this.contracts;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndexResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndexResponse.java
new file mode 100644
index 0000000..34fe761
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AssetIndexResponse.java
@@ -0,0 +1,23 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.AssetIndexRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 7/31/2017
+ */
+public class AssetIndexResponse extends ResponseBase {
+
+ @SerializedName("asset_index")
+ private AssetIndex[] assetIndex;
+
+ public AssetIndex[] getAssetIndex() {
+ return assetIndex;
+ }
+
+ public void setAssetIndex(AssetIndex[] assetIndex) {
+ this.assetIndex = assetIndex;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/Authorize.java b/Trading/src/main/java/com/suneesh/trading/models/responses/Authorize.java
new file mode 100644
index 0000000..d7aaa72
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/Authorize.java
@@ -0,0 +1,147 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.math.BigDecimal;
+
+/**
+ * Created by morteza on 7/28/2017.
+ */
+public class Authorize {
+ @SerializedName("email")
+ private String email;
+
+ @SerializedName("currency")
+ private String currency;
+
+ @SerializedName("balance")
+ private BigDecimal balance;
+
+ @SerializedName("loginid")
+ private String loginId;
+
+ @SerializedName("is_virtual")
+ private int isVirtual;
+
+ @SerializedName("landing_company_name")
+ private String landingCompanyName;
+
+ @SerializedName("landing_company_fullname")
+ private String landingCompanyFullName;
+
+ @SerializedName("country")
+ private String country;
+
+ @SerializedName("fullname")
+ private String fullName;
+
+ @SerializedName("scopes")
+ private String[] scopes;
+
+ @SerializedName("allow_omnibus")
+ private int allowOmnibus;
+
+ @SerializedName("sub_accounts")
+ private SubAccount[] subAccounts;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public BigDecimal getBalance() {
+ return balance;
+ }
+
+ public void setBalance(BigDecimal balance) {
+ this.balance = balance;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ public int getIsVirtual() {
+ return isVirtual;
+ }
+
+ public void setIsVirtual(int isVirtual) {
+ this.isVirtual = isVirtual;
+ }
+
+ public String getLandingCompanyName() {
+ return landingCompanyName;
+ }
+
+ public void setLandingCompanyName(String landingCompanyName) {
+ this.landingCompanyName = landingCompanyName;
+ }
+
+ public String getLandingCompanyFullName() {
+ return landingCompanyFullName;
+ }
+
+ public void setLandingCompanyFullName(String landingCompanyFullName) {
+ this.landingCompanyFullName = landingCompanyFullName;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String[] getScopes() {
+ return scopes;
+ }
+
+ public void setScopes(String[] scopes) {
+ this.scopes = scopes;
+ }
+
+ public int getAllowOmnibus() {
+ return allowOmnibus;
+ }
+
+ public void setAllowOmnibus(int allowOmnibus) {
+ this.allowOmnibus = allowOmnibus;
+ }
+
+ public SubAccount[] getSubAccounts() {
+ return subAccounts;
+ }
+
+ public void setSubAccounts(SubAccount[] subAccounts) {
+ this.subAccounts = subAccounts;
+ }
+}
\ No newline at end of file
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/AuthorizeResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/AuthorizeResponse.java
new file mode 100644
index 0000000..c544a64
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/AuthorizeResponse.java
@@ -0,0 +1,46 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.AuthorizeRequest;
+import com.google.gson.annotations.SerializedName;
+import com.suneesh.trading.utils.AutoTradingUtility;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Created by morteza on 7/28/2017.
+ */
+public class AuthorizeResponse extends ResponseBase {
+ @SerializedName("authorize")
+ private Authorize authorize;
+
+ public Authorize getAuthorize() {
+ return authorize;
+ }
+
+ public void setAuthorize(Authorize authorize) {
+ this.authorize = authorize;
+ }
+
+ @Override
+ public List databaseInsertStringList(){
+ return Arrays.asList(
+ "INSERT INTO public.authorize " +
+ "(allow_omnibus ,balance ,country ,currency ,email ,full_name ,is_virtual ," +
+ " landing_company_full_name ,landing_company_name, login_id ) " +
+ " VALUES ("
+ + AutoTradingUtility.quotedString(authorize.getAllowOmnibus()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getBalance()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getCountry()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getCurrency()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getEmail()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getFullName()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getIsVirtual()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getLandingCompanyFullName()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getLandingCompanyName()) + ", "
+ + AutoTradingUtility.quotedString(authorize.getLoginId()) + ");"
+ );
+
+ }
+
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/Balance.java b/Trading/src/main/java/com/suneesh/trading/models/responses/Balance.java
new file mode 100644
index 0000000..88bc863
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/Balance.java
@@ -0,0 +1,61 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import io.reactivex.annotations.Nullable;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.math.BigDecimal;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+@Data
+public class Balance {
+ /**
+ * Balance amount
+ */
+ @SerializedName("balance")
+ private BigDecimal balance;
+
+ /**
+ * Currency Example: USD
+ */
+ @SerializedName("currency")
+ private String currency;
+
+ /**
+ * Client loginid Example: CR000000
+ */
+ @SerializedName("loginid")
+ private String loginId;
+
+ /**
+ * A stream id that can be used to cancel this stream using the Forget request.
+ * Example: 1d6651e7d599bce6c54bd71a8283e579
+ */
+ @SerializedName("id")
+ @Nullable
+ private String id;
+
+ public BigDecimal getBalance() {
+ return balance;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public String getLoginId() {
+ return loginId;
+ }
+
+ public String getId() {
+ return id;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/BalanceResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/BalanceResponse.java
new file mode 100644
index 0000000..588d723
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/BalanceResponse.java
@@ -0,0 +1,51 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.BalanceRequest;
+import com.google.gson.annotations.SerializedName;
+import com.suneesh.trading.utils.AutoTradingUtility;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * BalanceResponse
+ *
+ * Realtime Balance
+ * Return details of user account balance
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/4/2017
+ */
+public class BalanceResponse extends ResponseBase {
+
+ /**
+ * Realtime stream of user balance changes.
+ */
+ @SerializedName("balance")
+ private Balance balance;
+
+ public Balance getBalance() {
+ return balance;
+ }
+
+ public void setBalance(Balance balance) {
+ this.balance = balance;
+ }
+
+ @Override
+ public List databaseInsertStringList(){
+ return Arrays.asList(
+ "INSERT INTO public.balance " +
+ "(balance , currency , login_id , time, time_string) " +
+ " VALUES ("
+ + AutoTradingUtility.quotedString(balance.getBalance()) + ", "
+ + AutoTradingUtility.quotedString(balance.getCurrency()) + ", "
+ + AutoTradingUtility.quotedString(balance.getLoginId()) + ", "
+ + " extract(epoch from now()), "
+ + " now()::timestamp );"
+ );
+
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractForMultipleAccountsResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractForMultipleAccountsResponse.java
new file mode 100644
index 0000000..c1ca1b8
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractForMultipleAccountsResponse.java
@@ -0,0 +1,41 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.BuyContractForMultipleAccountsRequest;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * BuyContractForMultipleAccountsResponse
+ *
+ * Buy a Contract for multiple Accounts Receive
+ *
+ * A message with transaction results is received
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class BuyContractForMultipleAccountsResponse extends ResponseBase {
+
+ /**
+ * Receipt confirmation for the purchase
+ */
+ @SerializedName("buy_contract_for_multiple_accounts")
+ private MassBuyContractResult buyContractResult;
+
+ public MassBuyContractResult getMassBuyContractResult() {
+ return buyContractResult;
+ }
+
+ public class MassBuyContractResult {
+
+ @SerializedName("result")
+ private List result;
+
+ public List getResult() {
+ return result;
+ }
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractResponse.java
new file mode 100644
index 0000000..25e609a
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyContractResponse.java
@@ -0,0 +1,31 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.BuyContractRequest;
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+
+/**
+ * BuyContractResponse
+ *
+ * Buy a Contract Receive
+ *
+ * A message with transaction results is received
+ *
+ *
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+@Data
+public class BuyContractResponse extends ResponseBase {
+
+ /**
+ *
+ */
+ @SerializedName("buy")
+ private BuyReceipt buyReceipt;
+
+ public BuyReceipt getBuyReceipt() {
+ return buyReceipt;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/BuyReceipt.java b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyReceipt.java
new file mode 100644
index 0000000..7a1c6cb
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/BuyReceipt.java
@@ -0,0 +1,132 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/8/2017
+ */
+public class BuyReceipt {
+
+ /**
+ * The new account balance after completion of the purchase
+ * (Required)
+ *
+ */
+ @SerializedName("balance_after")
+ private BigDecimal balanceAfter;
+
+ /**
+ * The description of contract purchased
+ * (Required)
+ *
+ */
+ @SerializedName("longcode")
+ private String longCode;
+
+ /**
+ * Compact description of the contract purchased
+ * (Required)
+ *
+ */
+ @SerializedName("shortcode")
+ private String shortCode;
+
+ /**
+ * Epoch value showing the expected start time of the contract
+ * (Required)
+ *
+ */
+ @SerializedName("start_time")
+ private Long startTime;
+
+ /**
+ * Internal contract identifier
+ * (Required)
+ *
+ */
+ @SerializedName("contract_id")
+ private Long contractId;
+
+ /**
+ * Actual effected purchase price
+ * (Required)
+ *
+ */
+ @SerializedName("buy_price")
+ private BigDecimal buyPrice;
+
+ /**
+ * Epoch value of the transaction purchase time
+ * (Required)
+ *
+ */
+ @SerializedName("purchase_time")
+ private Long purchaseTime;
+
+ /**
+ * Internal transaction identifier
+ * (Required)
+ *
+ */
+ @SerializedName("transaction_id")
+ private Long transactionId;
+
+ /**
+ * Proposed payout value
+ * (Required)
+ *
+ */
+ @SerializedName("payout")
+ private BigDecimal payout;
+
+ /**
+ * Account token that contract is bought for it.
+ * Note: it is just available when request is BuyContractForMultipleAccounts
+ */
+ @SerializedName("token")
+ private String token;
+
+ public BigDecimal getBalanceAfter() {
+ return balanceAfter;
+ }
+
+ public String getLongCode() {
+ return longCode;
+ }
+
+ public String getShortCode() {
+ return shortCode;
+ }
+
+ public Long getStartTime() {
+ return startTime;
+ }
+
+ public Long getContractId() {
+ return contractId;
+ }
+
+ public BigDecimal getBuyPrice() {
+ return buyPrice;
+ }
+
+ public Long getPurchaseTime() {
+ return purchaseTime;
+ }
+
+ public Long getTransactionId() {
+ return transactionId;
+ }
+
+ public BigDecimal getPayout() {
+ return payout;
+ }
+
+ public String getToken() {
+ return token;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/Candle.java b/Trading/src/main/java/com/suneesh/trading/models/responses/Candle.java
new file mode 100644
index 0000000..64227c0
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/Candle.java
@@ -0,0 +1,104 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/3/2017
+ */
+
+@Data
+public class Candle {
+ /**
+ * It is an epoch value
+ */
+ @SerializedName("epoch")
+ private Integer epoch;
+
+ @SerializedName("open_time")
+ private Integer open_time;
+ /**
+ * It is the open price value for the given time
+ */
+ @SerializedName("open")
+ private BigDecimal open;
+
+ /**
+ * It is the high price value for the given time
+ */
+ @SerializedName("high")
+ private BigDecimal high;
+
+ /**
+ * It is the low price value for the given time
+ */
+ @SerializedName("low")
+ private BigDecimal low;
+
+ /**
+ * It is the close price value for the given time
+ */
+ @SerializedName("close")
+ private BigDecimal close;
+
+ @SerializedName("granularity")
+ private Integer granularity;
+
+ @SerializedName("symbol")
+ private String symbol;
+
+ @SerializedName("direction")
+ private String direction;
+
+ private BigDecimal openCloseDiff;
+
+ public String getWriteTimeEpoch() {
+ return writeTimeEpoch;
+ }
+
+ public void setWriteTimeEpoch() {
+ this.writeTimeEpoch = "extract(epoch from now() )";
+ }
+
+ private String writeTimeEpoch;
+
+ public void setDirection() {
+ this.direction = (close.compareTo(open)>=0) ? "UP" : "DOWN";;
+ }
+
+ public String getDirection() {
+ return direction;
+ }
+
+ public BigDecimal getOpenCloseDiff() {
+ return openCloseDiff;
+ }
+
+ public void setOpenCloseDiff() {
+ this.openCloseDiff = close.subtract(open);
+ }
+
+ public Integer getEpoch() {
+ return epoch;
+ }
+
+ public BigDecimal getOpen() {
+ return open;
+ }
+
+ public BigDecimal getHigh() {
+ return high;
+ }
+
+ public BigDecimal getLow() {
+ return low;
+ }
+
+ public BigDecimal getClose() {
+ return close;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/CashierPasswordResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/CashierPasswordResponse.java
new file mode 100644
index 0000000..b38f2be
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/CashierPasswordResponse.java
@@ -0,0 +1,19 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.CashierPasswordRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/14/2017
+ */
+public class CashierPasswordResponse extends ResponseBase {
+
+ @SerializedName("cashier_password")
+ private Integer lock;
+
+ public boolean isLock() {
+ return lock == 1 ? true : false;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/CashierURLResponse.java b/Trading/src/main/java/com/suneesh/trading/models/responses/CashierURLResponse.java
new file mode 100644
index 0000000..5ec3667
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/CashierURLResponse.java
@@ -0,0 +1,25 @@
+package com.suneesh.trading.models.responses;
+
+import com.suneesh.trading.models.requests.CashierURLRequest;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 9/14/2017
+ */
+public class CashierURLResponse extends ResponseBase {
+
+ /**
+ * cashier url,
+ * Note possible error codes: ASK_TNC_APPROVAL (API tnc_approval), ASK_AUTHENTICATE,
+ * ASK_UK_FUNDS_PROTECTION (API tnc_approval), ASK_CURRENCY (API set_account_currency),
+ * ASK_EMAIL_VERIFY (verify_email), ASK_FIX_DETAILS (API set_settings)
+ */
+ @SerializedName("cashier")
+ private String cashierURL;
+
+ public String getCashierURL() {
+ return cashierURL;
+ }
+}
diff --git a/Trading/src/main/java/com/suneesh/trading/models/responses/Company.java b/Trading/src/main/java/com/suneesh/trading/models/responses/Company.java
new file mode 100644
index 0000000..dede280
--- /dev/null
+++ b/Trading/src/main/java/com/suneesh/trading/models/responses/Company.java
@@ -0,0 +1,125 @@
+package com.suneesh.trading.models.responses;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * @author Morteza Tavanarad
+ * @version 1.0.0
+ * @since 8/1/2017
+ */
+public class Company {
+
+ /**
+ * Landing Company short code
+ */
+ @SerializedName("shortcode")
+ private String shortCode;
+
+ /**
+ * Landing Company legal name
+ */
+ @SerializedName("name")
+ private String name;
+
+ /**
+ * Landing Company address
+ */
+ @SerializedName("address")
+ private List address;
+
+ /**
+ * Landing Company country of incorporation
+ */
+ @SerializedName("country")
+ private String country;
+
+ /**
+ * Default account currency
+ */
+ @SerializedName("legal_default_currency")
+ private String legalDefaultCurrency;
+
+ /**
+ * Allowable currencies
+ */
+ @SerializedName("legal_allowed_currencies")
+ private List legalAllowedCurrencies;
+
+ /**
+ * Allowable markets
+ */
+ @SerializedName("legal_allowed_markets")
+ private List legalAllowedMarkets;
+
+ /**
+ * Allowed contract types
+ */
+ @SerializedName("legal_allowed_contract_categories")
+ private List legalAllowedContractCategories;
+
+ public String getShortCode() {
+ return shortCode;
+ }
+
+ public void setShortCode(String shortCode) {
+ this.shortCode = shortCode;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List getAddress() {
+ return address;
+ }
+
+ public void setAddress(List address) {
+ this.address = address;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getLegalDefaultCurrency() {
+ return legalDefaultCurrency;
+ }
+
+ public void setLegalDefaultCurrency(String legalDefaultCurrency) {
+ this.legalDefaultCurrency = legalDefaultCurrency;
+ }
+
+ public List getLegalAllowedCurrencies() {
+ return legalAllowedCurrencies;
+ }
+
+ public void setLegalAllowedCurrencies(List legalAllowedCurrencies) {
+ this.legalAllowedCurrencies = legalAllowedCurrencies;
+ }
+
+ public List getLegalAllowedMarkets() {
+ return legalAllowedMarkets;
+ }
+
+ public void setLegalAllowedMarkets(List