├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── build.gradle
├── docs
├── Authenticating.md
├── Balance-info.md
├── Configuring-the-SDK.md
├── Gemfile
├── Linking-a-broker-with-OAuth.md
├── Orders-status.md
├── Portfolio-positions.md
├── README.md
├── Relinking.md
├── Special-Cases.md
├── Testing.md
├── Trading.md
├── Unlinking.md
├── _config.yml
├── _includes
│ └── _Sidebar.html
├── _layouts
│ └── default.html
├── css
│ ├── documentation.css
│ ├── documentation.css.map
│ ├── main.css
│ ├── main.css.map
│ └── normalize.min.css
├── fonts
│ ├── HelveticaNeue-Bold.eot
│ ├── HelveticaNeue-Bold.ttf
│ ├── HelveticaNeue-Bold.woff
│ ├── HelveticaNeue-BoldItalic.eot
│ ├── HelveticaNeue-BoldItalic.ttf
│ ├── HelveticaNeue-BoldItalic.woff
│ ├── HelveticaNeue-Italic.eot
│ ├── HelveticaNeue-Italic.ttf
│ ├── HelveticaNeue-Italic.woff
│ ├── HelveticaNeue-Light.eot
│ ├── HelveticaNeue-Light.ttf
│ ├── HelveticaNeue-Light.woff
│ ├── HelveticaNeue-LightItalic.eot
│ ├── HelveticaNeue-LightItalic.ttf
│ ├── HelveticaNeue-LightItalic.woff
│ ├── HelveticaNeue-Medium.eot
│ ├── HelveticaNeue-Medium.ttf
│ ├── HelveticaNeue-Medium.woff
│ ├── HelveticaNeue-UltraLight.eot
│ ├── HelveticaNeue-UltraLight.ttf
│ ├── HelveticaNeue-UltraLight.woff
│ ├── HelveticaNeue-UltraLightItalic.eot
│ ├── HelveticaNeue-UltraLightItalic.ttf
│ ├── HelveticaNeue-UltraLightItalic.woff
│ ├── HelveticaNeue.eot
│ ├── HelveticaNeue.ttf
│ ├── HelveticaNeue.woff
│ ├── Monaco.eot
│ ├── Monaco.ttf
│ └── Monaco.woff
├── img
│ ├── logo.svg
│ └── navbar-icon.svg
└── index.md
├── exampleApp
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── it
│ │ └── trade
│ │ └── android
│ │ └── exampleapp
│ │ └── MainActivityTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── it
│ │ └── trade
│ │ └── android
│ │ └── exampleapp
│ │ ├── BrokersListActivity.java
│ │ ├── GetCryptoQuoteActivity.java
│ │ ├── LinkedBrokerAccountsActivity.java
│ │ ├── LinkedBrokersActivity.java
│ │ ├── MainActivity.java
│ │ ├── OauthLinkBrokerActivity.java
│ │ ├── OrdersStatusActivity.java
│ │ ├── ParceledAccountActivity.java
│ │ ├── PositionsActivity.java
│ │ ├── PreviewCryptoOrderActivity.java
│ │ ├── PreviewOrderActivity.java
│ │ ├── RequestInterceptorParcelableImpl.java
│ │ ├── adapters
│ │ └── BrokerAdapter.java
│ │ └── customtabs
│ │ ├── CustomTabActivityHelper.java
│ │ ├── CustomTabsHelper.java
│ │ ├── KeepAliveService.java
│ │ ├── ServiceConnection.java
│ │ └── ServiceConnectionCallback.java
│ └── res
│ ├── drawable
│ └── row_border.xml
│ ├── layout
│ ├── activity_brokers_list.xml
│ ├── activity_get_crypto_quote.xml
│ ├── activity_linked_broker_accounts.xml
│ ├── activity_linked_brokers.xml
│ ├── activity_main.xml
│ ├── activity_oauth_link_broker.xml
│ ├── activity_orders_status.xml
│ ├── activity_parceled_account.xml
│ ├── activity_positions.xml
│ └── activity_preview_order.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── exampleAppKotlin
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── kotlin
│ │ └── it
│ │ └── trade
│ │ └── android
│ │ └── exampleapp
│ │ └── MainActivityTest.kt
│ └── main
│ ├── AndroidManifest.xml
│ ├── kotlin
│ └── it
│ │ └── trade
│ │ └── android
│ │ └── exampleapp
│ │ ├── BrokersListActivity.kt
│ │ ├── GetCryptoQuoteActivity.kt
│ │ ├── LinkedBrokerAccountsActivity.kt
│ │ ├── LinkedBrokersActivity.kt
│ │ ├── MainActivity.kt
│ │ ├── OauthLinkBrokerActivity.kt
│ │ ├── OrdersStatusActivity.kt
│ │ ├── ParceledAccountActivity.kt
│ │ ├── PositionsActivity.kt
│ │ ├── PreviewCryptoOrderActivity.kt
│ │ ├── PreviewOrderActivity.kt
│ │ ├── RequestInterceptorParcelableImpl.kt
│ │ ├── adapters
│ │ └── BrokerAdapter.kt
│ │ └── customtabs
│ │ ├── CustomTabActivityHelper.kt
│ │ ├── CustomTabsHelper.kt
│ │ ├── KeepAliveService.kt
│ │ ├── ServiceConnection.kt
│ │ └── ServiceConnectionCallback.kt
│ └── res
│ ├── drawable
│ └── row_border.xml
│ ├── layout
│ ├── activity_brokers_list.xml
│ ├── activity_get_crypto_quote.xml
│ ├── activity_linked_broker_accounts.xml
│ ├── activity_linked_brokers.xml
│ ├── activity_main.xml
│ ├── activity_oauth_link_broker.xml
│ ├── activity_orders_status.xml
│ ├── activity_parceled_account.xml
│ ├── activity_positions.xml
│ └── activity_preview_order.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── tradeit-android-sdk
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── kotlin
│ └── it
│ └── trade
│ └── android
│ └── sdk
│ ├── UnitTestSuite.kt
│ ├── manager
│ └── TradeItLinkedBrokerManagerTest.kt
│ └── model
│ ├── TradeItCryptoOrderParcelableTest.kt
│ ├── TradeItCryptoQuoteResponseParcelableTest.kt
│ ├── TradeItErrorResultParcelableTest.kt
│ ├── TradeItLinkedBrokerAccountParcelableTest.kt
│ ├── TradeItLinkedBrokerParcelableTest.kt
│ ├── TradeItOrderCapabilityParcelableTest.kt
│ ├── TradeItOrderParcelableTest.kt
│ ├── TradeItOrderStatusParcelableTest.kt
│ ├── TradeItPlaceCryptoOrderResponseParcelableTest.kt
│ ├── TradeItPlaceStockOrEtfOrderResponseParcelableTest.kt
│ ├── TradeItPreviewCryptoOrderResponseParcelableTest.kt
│ ├── TradeItPreviewStockOrEtfOrderResponseParcelableTest.kt
│ └── TradeItSecurityQuestionParcelableTest.kt
├── main
├── AndroidManifest.xml
├── kotlin
│ └── it
│ │ └── trade
│ │ └── android
│ │ └── sdk
│ │ ├── TradeItConfigurationBuilder.kt
│ │ ├── TradeItSDK.kt
│ │ ├── TradeItSdkInstance.kt
│ │ ├── enums
│ │ ├── TradeItOrderAction.kt
│ │ ├── TradeItOrderExpirationType.kt
│ │ ├── TradeItOrderPriceType.kt
│ │ └── TradeItOrderQuantityType.kt
│ │ ├── exceptions
│ │ ├── TradeItDeleteLinkedLoginException.kt
│ │ ├── TradeItKeystoreServiceCreateKeyException.kt
│ │ ├── TradeItKeystoreServiceDecryptException.kt
│ │ ├── TradeItKeystoreServiceDeleteKeyException.kt
│ │ ├── TradeItKeystoreServiceEncryptException.kt
│ │ ├── TradeItRetrieveLinkedLoginException.kt
│ │ ├── TradeItSDKConfigurationException.kt
│ │ ├── TradeItSaveLinkedLoginException.kt
│ │ └── TradeItUpdateLinkedLoginException.kt
│ │ ├── internal
│ │ ├── LinkedBrokersParcelableList.kt
│ │ └── TradeItKeystoreService.kt
│ │ ├── manager
│ │ └── TradeItLinkedBrokerManager.kt
│ │ └── model
│ │ ├── RequestInterceptorParcelable.kt
│ │ ├── SymbolPairParcelable.kt
│ │ ├── TradeItApiClientParcelable.kt
│ │ ├── TradeItBalanceParcelable.kt
│ │ ├── TradeItCallBackCompletion.kt
│ │ ├── TradeItCallbackWithSecurityQuestionAndCompletion.kt
│ │ ├── TradeItCryptoOrderParcelable.kt
│ │ ├── TradeItCryptoPreviewOrderDetailsParcelable.kt
│ │ ├── TradeItCryptoQuoteResponseParcelable.kt
│ │ ├── TradeItCryptoTradeOrderDetailsParcelable.kt
│ │ ├── TradeItErrorResultParcelable.kt
│ │ ├── TradeItFxBalanceParcelable.kt
│ │ ├── TradeItLinkedBrokerAccountData.kt
│ │ ├── TradeItLinkedBrokerAccountParcelable.kt
│ │ ├── TradeItLinkedBrokerCache.kt
│ │ ├── TradeItLinkedBrokerData.kt
│ │ ├── TradeItLinkedBrokerParcelable.kt
│ │ ├── TradeItLinkedLoginParcelable.kt
│ │ ├── TradeItOrderActionParcelable.kt
│ │ ├── TradeItOrderCapabilityParcelable.kt
│ │ ├── TradeItOrderDetailsParcelable.kt
│ │ ├── TradeItOrderExpirationTypeParcelable.kt
│ │ ├── TradeItOrderInfoParcelable.kt
│ │ ├── TradeItOrderParcelable.kt
│ │ ├── TradeItOrderPriceTypeParcelable.kt
│ │ ├── TradeItPlaceCryptoOrderResponseParcelable.kt
│ │ ├── TradeItPlaceStockOrEtfOrderResponseParcelable.kt
│ │ ├── TradeItPositionParcelable.kt
│ │ ├── TradeItPreviewCryptoOrderResponseParcelable.kt
│ │ ├── TradeItPreviewStockOrEtfOrderResponseParcelable.kt
│ │ ├── TradeItPriceParcelable.kt
│ │ ├── TradeItSecurityQuestionParcelable.kt
│ │ ├── TradeItWarningLinkParcelable.kt
│ │ ├── TradeItWarningParcelable.kt
│ │ └── orderstatus
│ │ ├── TradeItFillParcelable.kt
│ │ ├── TradeItOrderLegParcelable.kt
│ │ ├── TradeItOrderStatusParcelable.kt
│ │ └── TradeItPriceInfoParcelable.kt
└── res
│ └── values
│ └── strings.xml
└── test
├── kotlin
└── it
│ └── trade
│ └── android
│ └── sdk
│ ├── manager
│ └── TradeItLinkedBrokerManagerSpec.kt
│ └── model
│ ├── TradeItCryptoOrderParcelableSpec.kt
│ ├── TradeItLinkedBrokerAccountParcelableSpec.kt
│ ├── TradeItLinkedBrokerCacheSpec.kt
│ ├── TradeItLinkedBrokerParcelableSpec.kt
│ └── TradeItOrderParcelableSpec.kt
└── resources
└── mockito-extensions
└── org.mockito.plugins.MockMaker
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .idea/
10 | *.lock
11 | _site/
12 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "docs/AndroidSDK.wiki"]
2 | path = docs/AndroidSDK.wiki
3 | url = https://github.com/tradingticket/AndroidSDK.wiki.git
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TradeIt Android SDK
2 |
3 | [Read the Wiki to get started!](https://github.com/tradingticket/AndroidSDK/wiki)
4 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.61'
5 | ext.anko_version = '0.10.5'
6 | repositories {
7 | jcenter()
8 | google()
9 | mavenCentral()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.2.0'
13 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
14 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
15 | classpath 'org.codehaus.groovy:groovy-android-gradle-plugin:1.1.0'
16 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17 | classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0.0"
18 |
19 | // NOTE: Do not place your application dependencies here; they belong
20 | // in the individual module build.gradle files
21 | }
22 | }
23 |
24 | allprojects {
25 | repositories {
26 | jcenter()
27 | mavenLocal() // to be able to use local snapshot
28 | google()
29 | }
30 | }
31 |
32 | task clean(type: Delete) {
33 | delete rootProject.buildDir
34 | }
35 |
--------------------------------------------------------------------------------
/docs/Authenticating.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Authenticating
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Authenticating.md %}
--------------------------------------------------------------------------------
/docs/Balance-info.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Balance info
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Balance-info.md %}
--------------------------------------------------------------------------------
/docs/Configuring-the-SDK.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Configuring the SDK
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Configuring-the-SDK.md %}
--------------------------------------------------------------------------------
/docs/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | # Hello! This is where you manage which Jekyll version is used to run.
4 | # When you want to use a different version, change it below, save the
5 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
6 | #
7 | # bundle exec jekyll serve
8 | #
9 | # This will help ensure the proper Jekyll version is running.
10 | # Happy Jekylling!
11 | gem "jekyll", "3.5.2"
12 |
13 | # This is the default theme for new Jekyll sites. You may change this to anything you like.
14 | gem "minima", "~> 2.0"
15 |
16 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
17 | # uncomment the line below. To upgrade, run `bundle update github-pages`.
18 | # gem "github-pages", group: :jekyll_plugins
19 |
20 | # If you have any plugins, put them here!
21 | group :jekyll_plugins do
22 | gem "jekyll-feed", "~> 0.6"
23 | end
24 |
25 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
26 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
27 |
28 |
--------------------------------------------------------------------------------
/docs/Linking-a-broker-with-OAuth.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Linking a broker with OAuth
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Linking-a-broker-with-OAuth.md %}
--------------------------------------------------------------------------------
/docs/Orders-status.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Orders status
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Orders-status.md %}
--------------------------------------------------------------------------------
/docs/Portfolio-positions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Portfolio positions
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Portfolio-positions.md %}
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | Use jekyll to generate the Android SDK documentation
2 |
3 | # Installation
4 |
5 | ```
6 | gem install jekyll bundler
7 | ```
8 |
9 | # Generate the documentation and test on local (should be executed on the docs directory)
10 | ```
11 | bundle exec jekyll serve
12 | ```
13 |
14 | Navigate to http://127.0.0.1:4000/home
15 |
16 | # Notice
17 |
18 | Files are generated into _site folder
--------------------------------------------------------------------------------
/docs/Relinking.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Relinking
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Relinking.md %}
--------------------------------------------------------------------------------
/docs/Special-Cases.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Special Cases
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Special-Cases.md %}
--------------------------------------------------------------------------------
/docs/Testing.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Testing
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Testing.md %}
7 |
--------------------------------------------------------------------------------
/docs/Trading.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Trading
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Trading.md %}
--------------------------------------------------------------------------------
/docs/Unlinking.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Unlinking
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Unlinking.md %}
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | # Welcome to Jekyll!
2 | #
3 | # This config file is meant for settings that affect your whole blog, values
4 | # which you are expected to set up once and rarely edit after that. If you find
5 | # yourself editing this file very often, consider using Jekyll's data files
6 | # feature for the data you need to update frequently.
7 | #
8 | # For technical reasons, this file is *NOT* reloaded automatically when you use
9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10 |
11 | # Site settings
12 | # These are used to personalize your new site. If you look in the HTML files,
13 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14 | # You can create any custom variable you would like, and they will be accessible
15 | # in the templates via {{ site.myvariable }}.
16 | title: Your awesome title
17 | email: your-email@example.com
18 | description: > # this means to ignore newlines until "baseurl:"
19 | Write an awesome description for your new site here. You can edit this
20 | line in _config.yml. It will appear in your document head meta (for
21 | Google search results) and in your feed.xml site description.
22 | baseurl: "" # the subpath of your site, e.g. /blog
23 | url: "" # the base hostname & protocol for your site, e.g. http://example.com
24 | twitter_username: jekyllrb
25 | github_username: jekyll
26 |
27 | # Build settings
28 | markdown: kramdown
29 |
30 | # Exclude from processing.
31 | # The following items will not be processed, by default. Create a custom list
32 | # to override the default setting.
33 | exclude:
34 | - Gemfile
35 | - Gemfile.lock
36 | - README.md
37 | - AndroidSDK.wiki
38 | - feed.xml # doesn't work, need investigation
39 |
40 | defaults:
41 | -
42 | scope:
43 | path: "" # an empty string here means all files in the project
44 | values:
45 | layout: "default"
--------------------------------------------------------------------------------
/docs/_includes/_Sidebar.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
11 |
14 |
17 |
20 |
23 |
26 |
29 |
32 |
35 |
38 |
39 |
--------------------------------------------------------------------------------
/docs/css/normalize.min.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Bold.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Bold.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Bold.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Bold.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-BoldItalic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-BoldItalic.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-BoldItalic.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-BoldItalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-BoldItalic.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Italic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Italic.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Italic.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Italic.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Light.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Light.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Light.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Light.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-LightItalic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-LightItalic.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-LightItalic.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-LightItalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-LightItalic.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Medium.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Medium.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Medium.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-Medium.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLight.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLight.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLight.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLight.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLight.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLightItalic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLightItalic.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLightItalic.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue-UltraLightItalic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue-UltraLightItalic.woff
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue.eot
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue.ttf
--------------------------------------------------------------------------------
/docs/fonts/HelveticaNeue.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/HelveticaNeue.woff
--------------------------------------------------------------------------------
/docs/fonts/Monaco.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/Monaco.eot
--------------------------------------------------------------------------------
/docs/fonts/Monaco.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/Monaco.ttf
--------------------------------------------------------------------------------
/docs/fonts/Monaco.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/docs/fonts/Monaco.woff
--------------------------------------------------------------------------------
/docs/img/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/img/navbar-icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Introduction
3 | layout: default
4 | ---
5 |
6 | {% include_relative AndroidSDK.wiki/Introduction.md %}
--------------------------------------------------------------------------------
/exampleApp/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/exampleApp/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 27
7 |
8 | lintOptions {
9 | disable 'InvalidPackage'
10 | }
11 |
12 | defaultConfig {
13 | applicationId "it.trade.android.exampleapp"
14 | minSdkVersion 19
15 | targetSdkVersion 27
16 | versionCode 1
17 | versionName "1.0"
18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
19 | multiDexEnabled true
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled true
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(dir: 'libs', include: ['*.jar'])
31 | implementation 'com.android.support:multidex:1.0.3'
32 | implementation 'com.android.support:customtabs:27.1.1'
33 | implementation 'com.android.support:appcompat-v7:27.1.1'
34 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
35 | implementation project(':tradeit-android-sdk')
36 | androidTestImplementation 'com.android.support:support-annotations:27.1.1'
37 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
38 | androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
39 | androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
40 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
41 | androidTestImplementation 'com.android.support.test:rules:1.0.2'
42 | }
43 | repositories {
44 | mavenCentral()
45 | }
46 |
--------------------------------------------------------------------------------
/exampleApp/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/guillaumedebavelaere/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/exampleApp/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
40 |
43 |
46 |
49 |
52 |
55 |
58 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/GetCryptoQuoteActivity.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.text.method.ScrollingMovementMethod;
7 | import android.widget.TextView;
8 |
9 | import it.trade.android.sdk.model.TradeItCryptoQuoteResponseParcelable;
10 |
11 | import static it.trade.android.exampleapp.MainActivity.GET_CRYPTO_QUOTE_PARAMETER;
12 |
13 | public class GetCryptoQuoteActivity extends AppCompatActivity {
14 |
15 | private TextView textView;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_get_crypto_quote);
21 |
22 | textView = (TextView) this.findViewById(R.id.get_crypto_quote_textview);
23 | textView.setMovementMethod(new ScrollingMovementMethod());
24 | Intent intent = getIntent();
25 | TradeItCryptoQuoteResponseParcelable cryptoQuoteResponseParcelable = intent
26 | .getParcelableExtra(GET_CRYPTO_QUOTE_PARAMETER);
27 | textView.setText(cryptoQuoteResponseParcelable.toString());
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/LinkedBrokerAccountsActivity.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.util.Log;
7 | import android.widget.TextView;
8 |
9 | import java.util.List;
10 |
11 | import it.trade.android.sdk.model.TradeItLinkedBrokerAccountParcelable;
12 | import it.trade.model.TradeItErrorResult;
13 | import it.trade.model.callback.TradeItCallback;
14 |
15 | import static it.trade.android.exampleapp.MainActivity.LINKED_BROKER_ACCOUNTS_PARAMETER;
16 |
17 | public class LinkedBrokerAccountsActivity extends AppCompatActivity {
18 | TextView textView;
19 | List linkedBrokerAccounts;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_linked_broker_accounts);
25 | this.textView = (TextView) this.findViewById(R.id.linked_broker_accounts_textview);
26 |
27 | Intent intent = getIntent();
28 | this.linkedBrokerAccounts = intent.getParcelableArrayListExtra(LINKED_BROKER_ACCOUNTS_PARAMETER);
29 |
30 | if (linkedBrokerAccounts.isEmpty()) {
31 | this.textView.setText("No linked broker accounts!");
32 | } else {
33 | // Refresh balance on the first account just to make sure that an unparcelled account works properly
34 | textView.setText("Refreshing first account balance again just to test...");
35 | linkedBrokerAccounts.get(0).refreshBalance(new TradeItCallback() {
36 | @Override
37 | public void onSuccess(TradeItLinkedBrokerAccountParcelable linkedBrokerAccountParcelable) {
38 | textView.setText("Refreshed first account balance again just to test.\n# of linkedBroker accounts: " + linkedBrokerAccounts.size() + "\n\n" + linkedBrokerAccounts.toString());
39 | }
40 |
41 | @Override
42 | public void onError(TradeItErrorResult error) {
43 | textView.setText("Refresh Balance ERROR:\n" + error);
44 | }
45 | });
46 | }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/LinkedBrokersActivity.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.text.method.ScrollingMovementMethod;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.TextView;
10 |
11 | import com.google.gson.Gson;
12 |
13 | import java.util.List;
14 |
15 | import it.trade.android.sdk.model.TradeItLinkedBrokerAccountParcelable;
16 | import it.trade.android.sdk.model.TradeItLinkedBrokerParcelable;
17 | import it.trade.model.TradeItErrorResult;
18 | import it.trade.model.TradeItSecurityQuestion;
19 | import it.trade.model.callback.TradeItCallbackWithSecurityQuestionImpl;
20 |
21 | import static it.trade.android.exampleapp.MainActivity.LINKED_BROKERS_PARAMETER;
22 |
23 | public class LinkedBrokersActivity extends AppCompatActivity {
24 | List linkedBrokers;
25 | TextView textView;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_linked_brokers);
31 | this.textView = (TextView) this.findViewById(R.id.linked_brokers_textview);
32 | this.textView.setMovementMethod(new ScrollingMovementMethod());
33 |
34 | Intent intent = getIntent();
35 | this.linkedBrokers = intent.getParcelableArrayListExtra(LINKED_BROKERS_PARAMETER);
36 |
37 | logBrokers();
38 | }
39 |
40 | public void authenticateFirstBroker(View view) {
41 | textView.setText("Authenticating...");
42 |
43 | this.linkedBrokers.get(0).authenticate(new TradeItCallbackWithSecurityQuestionImpl>() {
44 | @Override
45 | public void onSecurityQuestion(TradeItSecurityQuestion securityQuestion) {
46 | textView.setText("Security Question:\n" + securityQuestion);
47 | }
48 |
49 | @Override
50 | public void onSuccess(List type) {
51 | textView.setText("Authenticate SUCCESS!");
52 | }
53 |
54 | @Override
55 | public void onError(TradeItErrorResult error) {
56 | textView.setText("Authenticate ERROR:\n" + error);
57 | }
58 | });
59 | }
60 |
61 | private void logBrokers() {
62 | if (this.linkedBrokers.isEmpty()) {
63 | this.textView.setText("No linked brokers!");
64 | } else {
65 | String output = "";
66 |
67 | output += "=== " + this.linkedBrokers.size() + " PARCELED LINKED BROKERS ===\n\n";
68 |
69 | for (TradeItLinkedBrokerParcelable linkedBroker : this.linkedBrokers) {
70 | String json = "LINKED BROKER: " + linkedBroker;
71 | output += json + "\n\n===\n\n";
72 | Log.d("TEST", json);
73 | }
74 |
75 | this.textView.setText(output);
76 | Log.d("TEST", "==========");
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/OrdersStatusActivity.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.text.method.ScrollingMovementMethod;
7 | import android.widget.TextView;
8 |
9 | import java.util.List;
10 |
11 | import it.trade.android.sdk.model.orderstatus.TradeItOrderStatusParcelable;
12 |
13 | import static it.trade.android.exampleapp.MainActivity.ORDERS_STATUS_PARAMETER;
14 |
15 | public class OrdersStatusActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_orders_status);
21 | TextView textView = (TextView) this.findViewById(R.id.orders_status_textview);
22 | textView.setMovementMethod(new ScrollingMovementMethod());
23 | Intent intent = getIntent();
24 | List ordersStatusDetailsList = intent.getParcelableArrayListExtra(ORDERS_STATUS_PARAMETER);
25 | textView.setText(ordersStatusDetailsList.toString());
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/PositionsActivity.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.text.method.ScrollingMovementMethod;
7 | import android.widget.TextView;
8 |
9 | import java.util.List;
10 |
11 | import it.trade.android.sdk.model.TradeItPositionParcelable;
12 |
13 | import static it.trade.android.exampleapp.MainActivity.POSITIONS_PARAMETER;
14 |
15 |
16 | public class PositionsActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_positions);
22 | TextView textView = (TextView) this.findViewById(R.id.positions_textview);
23 | textView.setMovementMethod(new ScrollingMovementMethod());
24 | Intent intent = getIntent();
25 | List positions = intent.getParcelableArrayListExtra(POSITIONS_PARAMETER);
26 | textView.setText(positions.toString());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/RequestInterceptorParcelableImpl.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp;
2 |
3 | import android.os.Parcel;
4 |
5 | import java.io.IOException;
6 |
7 | import it.trade.android.sdk.model.RequestInterceptorParcelable;
8 | import okhttp3.Request;
9 | import okhttp3.Response;
10 |
11 | public class RequestInterceptorParcelableImpl extends RequestInterceptorParcelable {
12 | @Override
13 | public Response intercept(Chain chain) throws IOException {
14 | Request originalRequest = chain.request();
15 | Request transformedRequest = originalRequest.newBuilder()
16 | .header("HeaderTestName", "HeaderTestValue")
17 | .header("HeaderTestName2", "HeaderTestValue2")
18 | .header("Cookie", "test1=value1; test2=value2")
19 | .method(originalRequest.method(), originalRequest.body())
20 | .build();
21 | return chain.proceed(transformedRequest);
22 | }
23 |
24 |
25 | @Override
26 | public int describeContents() {
27 | return 0;
28 | }
29 |
30 | @Override
31 | public void writeToParcel(Parcel dest, int flags) {
32 | }
33 |
34 | public RequestInterceptorParcelableImpl() {
35 | }
36 |
37 | protected RequestInterceptorParcelableImpl(Parcel in) {
38 | }
39 |
40 | public static final Creator CREATOR = new Creator() {
41 | @Override
42 | public RequestInterceptorParcelableImpl createFromParcel(Parcel source) {
43 | return new RequestInterceptorParcelableImpl(source);
44 | }
45 |
46 | @Override
47 | public RequestInterceptorParcelableImpl[] newArray(int size) {
48 | return new RequestInterceptorParcelableImpl[size];
49 | }
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/adapters/BrokerAdapter.java:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp.adapters;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ArrayAdapter;
8 | import android.widget.TextView;
9 |
10 | import java.util.List;
11 |
12 | import it.trade.model.reponse.TradeItAvailableBrokersResponse.Broker;
13 |
14 | public class BrokerAdapter extends ArrayAdapter {
15 |
16 | public BrokerAdapter(Context context, List items) {
17 | super(context, android.R.layout.simple_spinner_item, items);
18 | }
19 |
20 | public View getView(int position, View convertView, ViewGroup parent) {
21 | // Get the data item for this position
22 | Broker broker = getItem(position);
23 | // Check if an existing view is being reused, otherwise inflate the view
24 | if (convertView == null) {
25 | convertView = LayoutInflater.from(getContext()).inflate(android.R.layout.simple_spinner_item, parent, false);
26 | }
27 | // Lookup view for data population
28 | TextView textView = (TextView) convertView;
29 |
30 | // Populate the data into the template view using the data object
31 | textView.setText(broker.longName);
32 |
33 | // Return the completed view to render on screen
34 | return convertView;
35 | }
36 |
37 | @Override
38 | public View getDropDownView(int position, View convertView, ViewGroup parent) {
39 | Broker broker = getItem(position);
40 |
41 | if(convertView == null){
42 | convertView = LayoutInflater.from(getContext()).inflate(android.R.layout.simple_spinner_dropdown_item,parent, false);
43 | }
44 |
45 | TextView textView = (TextView) convertView;
46 | textView.setText(broker.longName);
47 |
48 | return convertView;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/customtabs/KeepAliveService.java:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs;
16 |
17 | import android.app.Service;
18 | import android.content.Intent;
19 | import android.os.Binder;
20 | import android.os.IBinder;
21 |
22 | /**
23 | * Empty service used by the custom tab to bind to, raising the application's importance.
24 | */
25 | public class KeepAliveService extends Service {
26 | private static final Binder sBinder = new Binder();
27 |
28 | @Override
29 | public IBinder onBind(Intent intent) {
30 | return sBinder;
31 | }
32 | }
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/customtabs/ServiceConnection.java:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs;
16 |
17 | import android.content.ComponentName;
18 | import android.support.customtabs.CustomTabsClient;
19 | import android.support.customtabs.CustomTabsServiceConnection;
20 |
21 | import java.lang.ref.WeakReference;
22 |
23 | /**
24 | * Implementation for the CustomTabsServiceConnection that avoids leaking the
25 | * ServiceConnectionCallback
26 | */
27 | public class ServiceConnection extends CustomTabsServiceConnection {
28 | // A weak reference to the ServiceConnectionCallback to avoid leaking it.
29 | private WeakReference mConnectionCallback;
30 |
31 | public ServiceConnection(ServiceConnectionCallback connectionCallback) {
32 | mConnectionCallback = new WeakReference<>(connectionCallback);
33 | }
34 |
35 | @Override
36 | public void onCustomTabsServiceConnected(ComponentName name, CustomTabsClient client) {
37 | ServiceConnectionCallback connectionCallback = mConnectionCallback.get();
38 | if (connectionCallback != null) connectionCallback.onServiceConnected(client);
39 | }
40 |
41 | @Override
42 | public void onServiceDisconnected(ComponentName name) {
43 | ServiceConnectionCallback connectionCallback = mConnectionCallback.get();
44 | if (connectionCallback != null) connectionCallback.onServiceDisconnected();
45 | }
46 | }
--------------------------------------------------------------------------------
/exampleApp/src/main/java/it/trade/android/exampleapp/customtabs/ServiceConnectionCallback.java:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs;
16 |
17 | import android.support.customtabs.CustomTabsClient;
18 |
19 | /**
20 | * Callback for events when connecting and disconnecting from Custom Tabs Service.
21 | */
22 | public interface ServiceConnectionCallback {
23 | /**
24 | * Called when the service is connected.
25 | * @param client a CustomTabsClient
26 | */
27 | void onServiceConnected(CustomTabsClient client);
28 |
29 | /**
30 | * Called when the service is disconnected.
31 | */
32 | void onServiceDisconnected();
33 | }
--------------------------------------------------------------------------------
/exampleApp/src/main/res/drawable/row_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_brokers_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_get_crypto_quote.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_linked_broker_accounts.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_linked_brokers.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
27 |
28 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
14 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_oauth_link_broker.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
31 |
32 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_orders_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_parceled_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
27 |
28 |
36 |
37 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_positions.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/layout/activity_preview_order.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
37 |
38 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleApp/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleApp/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleApp/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleApp/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleApp/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleApp/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleApp/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleApp/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dp
4 | 10dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidExampleApp
3 | GetCryptoQuoteActivity
4 |
5 |
--------------------------------------------------------------------------------
/exampleApp/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/exampleAppKotlin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/exampleAppKotlin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 27
7 |
8 | lintOptions {
9 | disable 'InvalidPackage'
10 | }
11 |
12 | sourceSets {
13 | main.java.srcDirs += "src/main/kotlin"
14 | test.java.srcDirs += "src/test/kotlin"
15 | androidTest.java.srcDirs += "src/androidTest/kotlin"
16 | }
17 |
18 | defaultConfig {
19 | applicationId "it.trade.android.exampleapp"
20 | minSdkVersion 19
21 | targetSdkVersion 27
22 | versionCode 1
23 | versionName "1.0"
24 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
25 | multiDexEnabled true
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled true
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | implementation fileTree(dir: 'libs', include: ['*.jar'])
37 | implementation 'com.android.support:multidex:1.0.3'
38 | implementation 'com.android.support:customtabs:27.1.1'
39 | implementation 'com.android.support:appcompat-v7:27.1.1'
40 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
41 | implementation "org.jetbrains.anko:anko:$anko_version"
42 | implementation project(':tradeit-android-sdk')
43 | androidTestImplementation 'com.android.support:support-annotations:27.1.1'
44 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
45 | androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
46 | androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
47 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
48 | androidTestImplementation 'com.android.support.test:rules:1.0.2'
49 | testImplementation 'junit:junit:4.12'
50 | }
51 | repositories {
52 | mavenCentral()
53 | }
54 |
--------------------------------------------------------------------------------
/exampleAppKotlin/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/guillaumedebavelaere/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
40 |
43 |
46 |
49 |
52 |
55 |
57 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/BrokersListActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.text.method.ScrollingMovementMethod
6 | import it.trade.android.exampleapp.adapters.BrokerAdapter
7 | import it.trade.android.sdk.TradeItSDK
8 | import it.trade.model.TradeItErrorResult
9 | import it.trade.model.callback.TradeItCallback
10 | import it.trade.model.reponse.Instrument
11 | import it.trade.model.reponse.TradeItAvailableBrokersResponse.Broker
12 | import kotlinx.android.synthetic.main.activity_brokers_list.*
13 |
14 | class BrokersListActivity : AppCompatActivity() {
15 | private var linkedBrokerManager = TradeItSDK.linkedBrokerManager
16 |
17 | override fun onCreate(savedInstanceState: Bundle?) {
18 | super.onCreate(savedInstanceState)
19 | setContentView(R.layout.activity_brokers_list)
20 | val brokersSpinner = brokers_spinner
21 | val textView = brokers_textview
22 | textView!!.movementMethod = ScrollingMovementMethod()
23 | val intent = intent
24 | val action = intent.extras!!.get(MainActivity.GET_BROKERS_LIST_PARAMETER) as MainActivity.MainActivityActions
25 | val brokersListActivity = this
26 | when (action) {
27 | MainActivity.MainActivityActions.GET_ALL_FEATURED_BROKERS -> linkedBrokerManager?.getAllFeaturedBrokers(object : TradeItCallback> {
28 | override fun onSuccess(brokersList: List) {
29 | brokersSpinner!!.adapter = BrokerAdapter(brokersListActivity, brokersList)
30 | textView.text = brokersList.toString()
31 | }
32 |
33 | override fun onError(error: TradeItErrorResult) {
34 | textView.text = error.toString()
35 | }
36 | })
37 | MainActivity.MainActivityActions.GET_ALL_NON_FEATURED_BROKERS -> linkedBrokerManager?.getAllNonFeaturedBrokers(object : TradeItCallback> {
38 | override fun onSuccess(brokersList: List) {
39 | brokersSpinner!!.adapter = BrokerAdapter(brokersListActivity, brokersList)
40 | textView.text = brokersList.toString()
41 | }
42 |
43 | override fun onError(error: TradeItErrorResult) {
44 | textView.text = error.toString()
45 | }
46 | })
47 | MainActivity.MainActivityActions.GET_FEATURED_EQUITY_BROKERS -> linkedBrokerManager.getFeaturedBrokersForInstrumentType(Instrument.EQUITIES, object : TradeItCallback> {
48 | override fun onSuccess(brokersList: List) {
49 | brokersSpinner!!.adapter = BrokerAdapter(brokersListActivity, brokersList)
50 | textView.text = brokersList.toString()
51 | }
52 |
53 | override fun onError(error: TradeItErrorResult) {
54 | textView.text = error.toString()
55 | }
56 | })
57 | MainActivity.MainActivityActions.GET_NON_FEATURED_EQUITY_BROKERS -> linkedBrokerManager.getNonFeaturedBrokersForInstrumentType(Instrument.EQUITIES, object : TradeItCallback> {
58 | override fun onSuccess(brokersList: List) {
59 | brokersSpinner!!.adapter = BrokerAdapter(brokersListActivity, brokersList)
60 | textView.text = brokersList.toString()
61 | }
62 |
63 | override fun onError(error: TradeItErrorResult) {
64 | textView.text = error.toString()
65 | }
66 | })
67 | else -> textView.text = "this action is not handled: ($action)"
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/GetCryptoQuoteActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.text.method.ScrollingMovementMethod
6 | import android.widget.TextView
7 | import it.trade.android.sdk.model.TradeItCryptoQuoteResponseParcelable
8 |
9 | class GetCryptoQuoteActivity : AppCompatActivity() {
10 |
11 | private var textView: TextView? = null
12 |
13 | override fun onCreate(savedInstanceState: Bundle?) {
14 | super.onCreate(savedInstanceState)
15 | setContentView(R.layout.activity_get_crypto_quote)
16 |
17 | textView = this.findViewById(R.id.get_crypto_quote_textview) as TextView
18 | textView!!.movementMethod = ScrollingMovementMethod()
19 | val intent = intent
20 | val cryptoQuoteResponseParcelable = intent
21 | .getParcelableExtra(MainActivity.GET_CRYPTO_QUOTE_PARAMETER) as TradeItCryptoQuoteResponseParcelable
22 | textView!!.setText(cryptoQuoteResponseParcelable.toString())
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/LinkedBrokerAccountsActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import it.trade.android.sdk.model.TradeItLinkedBrokerAccountParcelable
6 | import it.trade.model.TradeItErrorResult
7 | import it.trade.model.callback.TradeItCallback
8 | import kotlinx.android.synthetic.main.activity_linked_broker_accounts.*
9 |
10 | class LinkedBrokerAccountsActivity : AppCompatActivity() {
11 |
12 | override fun onCreate(savedInstanceState: Bundle?) {
13 | super.onCreate(savedInstanceState)
14 | setContentView(R.layout.activity_linked_broker_accounts)
15 | val textView = linked_broker_accounts_textview
16 |
17 | val intent = intent
18 | val linkedBrokerAccounts = intent.getParcelableArrayListExtra(MainActivity.LINKED_BROKER_ACCOUNTS_PARAMETER)
19 |
20 | if (linkedBrokerAccounts.isEmpty()) {
21 | textView!!.text = "No linked broker accounts!"
22 | } else {
23 | // Refresh balance on the first account just to make sure that an unparcelled account works properly
24 | textView!!.text = "Refreshing first account balance again just to test..."
25 | linkedBrokerAccounts[0].refreshBalance(object : TradeItCallback {
26 | override fun onSuccess(linkedBrokerAccountParcelable: TradeItLinkedBrokerAccountParcelable) {
27 | textView.text = "Refreshed first account balance again just to test.\n# of linkedBroker accounts: " + linkedBrokerAccounts.size + "\n\n" + linkedBrokerAccounts.toString()
28 | }
29 |
30 | override fun onError(error: TradeItErrorResult) {
31 | textView.text = "Refresh Balance ERROR:\n$error"
32 | }
33 | })
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/LinkedBrokersActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.text.method.ScrollingMovementMethod
6 | import android.util.Log
7 | import android.view.View
8 | import android.widget.TextView
9 | import it.trade.android.sdk.model.TradeItLinkedBrokerAccountParcelable
10 | import it.trade.android.sdk.model.TradeItLinkedBrokerParcelable
11 | import it.trade.model.TradeItErrorResult
12 | import it.trade.model.TradeItSecurityQuestion
13 | import it.trade.model.callback.TradeItCallbackWithSecurityQuestionImpl
14 | import kotlinx.android.synthetic.main.activity_linked_brokers.*
15 |
16 | class LinkedBrokersActivity : AppCompatActivity() {
17 | private lateinit var linkedBrokers: List
18 | private lateinit var textView: TextView
19 |
20 | override fun onCreate(savedInstanceState: Bundle?) {
21 | super.onCreate(savedInstanceState)
22 | setContentView(R.layout.activity_linked_brokers)
23 | textView = linked_brokers_textview
24 | textView.movementMethod = ScrollingMovementMethod()
25 |
26 | linkedBrokers = intent.getParcelableArrayListExtra(MainActivity.LINKED_BROKERS_PARAMETER)
27 |
28 | logBrokers()
29 | }
30 |
31 | fun authenticateFirstBroker(view: View) {
32 | textView.text = "Authenticating..."
33 |
34 | linkedBrokers[0].authenticate(object : TradeItCallbackWithSecurityQuestionImpl>() {
35 | override fun onSecurityQuestion(securityQuestion: TradeItSecurityQuestion) {
36 | textView.text = "Security Question:\n$securityQuestion"
37 | }
38 |
39 | override fun onSuccess(type: List) {
40 | textView.text = "Authenticate SUCCESS!"
41 | }
42 |
43 | override fun onError(error: TradeItErrorResult) {
44 | textView.text = "Authenticate ERROR:\n$error"
45 | }
46 | })
47 | }
48 |
49 | private fun logBrokers() {
50 | if (linkedBrokers.isEmpty()) {
51 | textView.text = "No linked brokers!"
52 | } else {
53 | val brokers = linkedBrokers.joinToString("\n\n==\n\n") { linkedBroker ->
54 | val json = "LINKED BROKER: $linkedBroker"
55 | Log.d("TEST", json)
56 | json
57 | }
58 |
59 | textView.text = "=== ${linkedBrokers.size} PARCELED LINKED BROKERS ===\n\n$brokers"
60 | Log.d("TEST", "==========")
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/OrdersStatusActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.support.v7.app.AppCompatActivity
6 | import android.text.method.ScrollingMovementMethod
7 | import android.widget.TextView
8 |
9 | import it.trade.android.sdk.model.orderstatus.TradeItOrderStatusParcelable
10 |
11 | import it.trade.android.exampleapp.MainActivity.Companion.ORDERS_STATUS_PARAMETER
12 |
13 | class OrdersStatusActivity : AppCompatActivity() {
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_orders_status)
18 | val textView = this.findViewById(R.id.orders_status_textview) as TextView?
19 | textView!!.movementMethod = ScrollingMovementMethod()
20 | val intent = intent
21 | val ordersStatusDetailsList = intent.getParcelableArrayListExtra(MainActivity.ORDERS_STATUS_PARAMETER)
22 | textView.text = ordersStatusDetailsList.toString()
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/PositionsActivity.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.text.method.ScrollingMovementMethod
6 | import android.widget.TextView
7 | import it.trade.android.sdk.model.TradeItPositionParcelable
8 |
9 |
10 | class PositionsActivity : AppCompatActivity() {
11 |
12 | override fun onCreate(savedInstanceState: Bundle?) {
13 | super.onCreate(savedInstanceState)
14 | setContentView(R.layout.activity_positions)
15 | val textView = this.findViewById(R.id.positions_textview) as TextView?
16 | textView!!.movementMethod = ScrollingMovementMethod()
17 | val intent = intent
18 | val positions = intent.getParcelableArrayListExtra(MainActivity.POSITIONS_PARAMETER)
19 | textView.text = positions.toString()
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/RequestInterceptorParcelableImpl.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import java.io.IOException
7 |
8 | import it.trade.android.sdk.model.RequestInterceptorParcelable
9 | import okhttp3.Interceptor
10 | import okhttp3.Request
11 | import okhttp3.Response
12 |
13 | class RequestInterceptorParcelableImpl : RequestInterceptorParcelable {
14 | @Throws(IOException::class)
15 | override fun intercept(chain: Interceptor.Chain): Response {
16 | val originalRequest = chain.request()
17 | val transformedRequest = originalRequest.newBuilder()
18 | .header("HeaderTestName", "HeaderTestValue")
19 | .header("HeaderTestName2", "HeaderTestValue2")
20 | .header("Cookie", "test1=value1; test2=value2")
21 | .method(originalRequest.method(), originalRequest.body())
22 | .build()
23 | return chain.proceed(transformedRequest)
24 | }
25 |
26 | override fun describeContents(): Int {
27 | return 0
28 | }
29 |
30 | override fun writeToParcel(dest: Parcel, flags: Int) {}
31 |
32 | constructor() {}
33 |
34 | protected constructor(`in`: Parcel) {}
35 |
36 | companion object {
37 |
38 | @JvmField
39 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
40 | override fun createFromParcel(source: Parcel): RequestInterceptorParcelableImpl {
41 | return RequestInterceptorParcelableImpl(source)
42 | }
43 |
44 | override fun newArray(size: Int): Array {
45 | return arrayOfNulls(size)
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/adapters/BrokerAdapter.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.exampleapp.adapters
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.ArrayAdapter
8 | import android.widget.TextView
9 |
10 | import it.trade.model.reponse.TradeItAvailableBrokersResponse.Broker
11 |
12 | class BrokerAdapter(context: Context, items: List) : ArrayAdapter(context, android.R.layout.simple_spinner_item, items) {
13 |
14 | override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
15 | // Get the data item for this position
16 | val broker = getItem(position)
17 | // Check if an existing view is being reused, otherwise inflate the view
18 | val view = convertView
19 | ?: LayoutInflater.from(context).inflate(android.R.layout.simple_spinner_item, parent, false)
20 |
21 | // Lookup view for data population
22 | val textView = view as TextView
23 | // Populate the data into the template view using the data object
24 | textView.text = broker!!.longName
25 |
26 | // Return the completed view to render on screen
27 | return view
28 | }
29 |
30 | override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup?): View {
31 | val broker = getItem(position)
32 | val view = convertView
33 | ?: LayoutInflater.from(context).inflate(android.R.layout.simple_spinner_dropdown_item, parent, false)
34 |
35 | val textView = view as TextView
36 | textView.text = broker!!.longName
37 |
38 | return view
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/customtabs/KeepAliveService.kt:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs
16 |
17 | import android.app.Service
18 | import android.content.Intent
19 | import android.os.Binder
20 | import android.os.IBinder
21 |
22 | /**
23 | * Empty service used by the custom tab to bind to, raising the application's importance.
24 | */
25 | class KeepAliveService : Service() {
26 |
27 | override fun onBind(intent: Intent): IBinder? {
28 | return sBinder
29 | }
30 |
31 | companion object {
32 | private val sBinder = Binder()
33 | }
34 | }
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/customtabs/ServiceConnection.kt:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs
16 |
17 | import android.content.ComponentName
18 | import android.support.customtabs.CustomTabsClient
19 | import android.support.customtabs.CustomTabsServiceConnection
20 |
21 | import java.lang.ref.WeakReference
22 |
23 | /**
24 | * Implementation for the CustomTabsServiceConnection that avoids leaking the
25 | * ServiceConnectionCallback
26 | */
27 | class ServiceConnection(connectionCallback: ServiceConnectionCallback) : CustomTabsServiceConnection() {
28 | // A weak reference to the ServiceConnectionCallback to avoid leaking it.
29 | private val mConnectionCallback: WeakReference = WeakReference(connectionCallback)
30 |
31 | override fun onCustomTabsServiceConnected(name: ComponentName, client: CustomTabsClient) {
32 | val connectionCallback = mConnectionCallback.get()
33 | connectionCallback?.onServiceConnected(client)
34 | }
35 |
36 | override fun onServiceDisconnected(name: ComponentName) {
37 | val connectionCallback = mConnectionCallback.get()
38 | connectionCallback?.onServiceDisconnected()
39 | }
40 | }
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/kotlin/it/trade/android/exampleapp/customtabs/ServiceConnectionCallback.kt:
--------------------------------------------------------------------------------
1 | // Copyright 2015 Google Inc. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package it.trade.android.exampleapp.customtabs
16 |
17 | import android.support.customtabs.CustomTabsClient
18 |
19 | /**
20 | * Callback for events when connecting and disconnecting from Custom Tabs Service.
21 | */
22 | interface ServiceConnectionCallback {
23 | /**
24 | * Called when the service is connected.
25 | * @param client a CustomTabsClient
26 | */
27 | fun onServiceConnected(client: CustomTabsClient)
28 |
29 | /**
30 | * Called when the service is disconnected.
31 | */
32 | fun onServiceDisconnected()
33 | }
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/drawable/row_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_brokers_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_get_crypto_quote.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_linked_broker_accounts.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_linked_brokers.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
27 |
28 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
14 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_oauth_link_broker.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
31 |
32 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_orders_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_parceled_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
27 |
28 |
36 |
37 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_positions.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/layout/activity_preview_order.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
24 |
25 |
37 |
38 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleAppKotlin/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleAppKotlin/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleAppKotlin/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleAppKotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/exampleAppKotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dp
4 | 10dp
5 |
6 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndroidExampleApp
3 |
4 |
--------------------------------------------------------------------------------
/exampleAppKotlin/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tradingticket/AndroidSDK/1d784e9eba023479652ccc5963ea7a77624bde01/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Aug 24 15:22:09 EET 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':exampleApp', ':exampleAppKotlin', ':tradeit-android-sdk'
2 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: "de.mannodermaus.android-junit5"
4 |
5 | ext {
6 | bintrayRepo = 'maven'
7 | bintrayName = 'tradeit-android-sdk'
8 |
9 | publishedGroupId = 'it.trade.tradeit'
10 | libraryName = 'tradeit-android-sdk'
11 | artifact = 'tradeit-android-sdk'
12 | libraryDescription = 'Android SDK for the Trade.it API: https://www.trade.it/api'
13 |
14 | siteUrl = 'https://github.com/tradingticket/AndroidSDK'
15 | gitUrl = 'https://github.com/tradingticket/AndroidSDK.git'
16 |
17 | libraryVersion = '1.0.30'
18 |
19 | developerId = 'tradingticket'
20 | developerName = 'Trade It'
21 | developerEmail = 'alex@trade.it'
22 |
23 | licenseName = 'The Apache Software License, Version 2.0'
24 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
25 | allLicenses = ["Apache-2.0"]
26 | }
27 |
28 | android {
29 | compileSdkVersion 27
30 |
31 | lintOptions {
32 | abortOnError false
33 | }
34 |
35 | defaultConfig {
36 | minSdkVersion 19
37 | targetSdkVersion 27
38 | versionCode 1
39 | versionName libraryVersion
40 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
41 | consumerProguardFiles 'proguard-rules.pro'
42 | multiDexEnabled true
43 | }
44 | buildTypes {
45 | release {
46 | minifyEnabled false
47 | }
48 | }
49 |
50 | sourceSets {
51 | main.java.srcDirs += "src/main/kotlin"
52 | test.java.srcDirs += 'src/test/kotlin'
53 | androidTest.java.srcDirs += "src/androidTest/kotlin"
54 | }
55 | }
56 |
57 | dependencies {
58 | implementation fileTree(include: ['*.jar'], dir: 'libs')
59 | implementation 'com.android.support:multidex:1.0.3'
60 | implementation 'com.android.support:appcompat-v7:27.1.1'
61 | api 'it.trade:tradeit-java-api:1.1.18'
62 | implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
63 | // Because RxAndroid releases are few and far between, it is recommended you also
64 | // explicitly depend on RxJava's latest version for bug fixes and new features.
65 | implementation 'io.reactivex.rxjava2:rxjava:2.0.9'
66 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
67 | androidTestImplementation 'com.android.support:support-annotations:27.1.1'
68 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
69 | androidTestImplementation 'com.android.support.test:rules:1.0.2'
70 | androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
71 | testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1'
72 | // (Required) Writing and executing Unit Tests on the JUnit Platform
73 | testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
74 | testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
75 | }
76 |
77 | apply from: 'https://raw.githubusercontent.com/tradingticket/JCenter/master/installv1.gradle'
78 | apply from: 'https://raw.githubusercontent.com/tradingticket/JCenter/master/bintrayv1.gradle'
79 | repositories {
80 | mavenCentral()
81 | }
82 |
83 | // Javadoc doesn't work with Kotlin :(
84 | tasks.withType(Javadoc).all {
85 | enabled = false
86 | }
87 |
88 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | -dontwarn okio.**
2 | -dontwarn org.slf4j.**
3 | -dontwarn ch.qos.logback.**
4 | -dontwarn retrofit2.Platform$Java8
5 | -dontwarn javax.annotation.**
6 |
7 | -printmapping out.map
8 |
9 | -keepparameternames
10 | -renamesourcefileattribute SourceFile
11 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
12 |
13 | -keep public class it.trade.** {
14 | public protected *;
15 | }
16 |
17 | -keepclassmembernames class it.trade.** {
18 | java.lang.Class class$(java.lang.String);
19 | java.lang.Class class$(java.lang.String, boolean);
20 | }
21 |
22 | -keepclasseswithmembernames,includedescriptorclasses class it.trade.** {
23 | native ;
24 | }
25 |
26 | -keepclassmembers,allowoptimization enum it.trade.** {
27 | public static **[] values(); public static ** valueOf(java.lang.String);
28 | }
29 |
30 | -keepclassmembers class it.trade.** implements java.io.Serializable {
31 | static final long serialVersionUID;
32 | private static final java.io.ObjectStreamField[] serialPersistentFields;
33 | private void writeObject(java.io.ObjectOutputStream);
34 | private void readObject(java.io.ObjectInputStream);
35 | java.lang.Object writeReplace();
36 | java.lang.Object readResolve();
37 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/UnitTestSuite.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk
2 |
3 | import it.trade.android.sdk.manager.TradeItLinkedBrokerManagerTest
4 | import it.trade.android.sdk.model.*
5 | import org.junit.runner.RunWith
6 | import org.junit.runners.Suite
7 |
8 |
9 | @RunWith(Suite::class)
10 | @Suite.SuiteClasses(TradeItLinkedBrokerManagerTest::class,
11 | TradeItErrorResultParcelableTest::class,
12 | TradeItLinkedBrokerAccountParcelableTest::class,
13 | TradeItLinkedBrokerParcelableTest::class,
14 | TradeItOrderCapabilityParcelableTest::class,
15 | TradeItOrderParcelableTest::class,
16 | TradeItOrderStatusParcelableTest::class,
17 | TradeItPlaceStockOrEtfOrderResponseParcelableTest::class,
18 | TradeItPreviewStockOrEtfOrderResponseParcelableTest::class,
19 | TradeItSecurityQuestionParcelableTest::class)
20 | class UnitTestSuite
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItCryptoQuoteResponseParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.runner.AndroidJUnit4
5 | import android.test.suitebuilder.annotation.SmallTest
6 | import org.hamcrest.Matchers.`is`
7 | import org.junit.Assert.assertThat
8 | import org.junit.Before
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 | import java.math.BigDecimal
12 |
13 | @RunWith(AndroidJUnit4::class)
14 | @SmallTest
15 | class TradeItCryptoQuoteResponseParcelableTest {
16 | private var cryptoQuoteResponseParcelable: TradeItCryptoQuoteResponseParcelable? = null
17 |
18 | @Before
19 | fun createTradeItCryptoQuote() {
20 | cryptoQuoteResponseParcelable = TradeItCryptoQuoteResponseParcelable()
21 | }
22 |
23 | @Test
24 | fun tradeItCryptoQuote_ParcelableWriteRead() {
25 | // Set up the Parcelable object to send and receive.
26 | cryptoQuoteResponseParcelable!!.ask = BigDecimal(9000.0)
27 | cryptoQuoteResponseParcelable!!.bid = BigDecimal(7000.0)
28 | cryptoQuoteResponseParcelable!!.open = BigDecimal(6000.0)
29 | cryptoQuoteResponseParcelable!!.last = BigDecimal(10000.0)
30 | cryptoQuoteResponseParcelable!!.volume = BigDecimal(154000.0)
31 | cryptoQuoteResponseParcelable!!.dateTime = "MyDateTime"
32 | cryptoQuoteResponseParcelable!!.dayLow = BigDecimal(5000.0)
33 | cryptoQuoteResponseParcelable!!.dayHigh = BigDecimal(11000.0)
34 |
35 | // Write the data.
36 | val parcel = Parcel.obtain()
37 | cryptoQuoteResponseParcelable!!.writeToParcel(parcel, cryptoQuoteResponseParcelable!!.describeContents())
38 |
39 | // After you're done with writing, you need to reset the parcel for reading.
40 | parcel.setDataPosition(0)
41 |
42 | // Read the data.
43 | val createdFromParcel = TradeItCryptoQuoteResponseParcelable.CREATOR.createFromParcel(parcel)
44 |
45 | // Verify that the received data is correct.
46 | assertThat(createdFromParcel.ask, `is`(cryptoQuoteResponseParcelable!!.ask))
47 | assertThat(createdFromParcel.bid, `is`(cryptoQuoteResponseParcelable!!.bid))
48 | assertThat(createdFromParcel.open, `is`(cryptoQuoteResponseParcelable!!.open))
49 | assertThat(createdFromParcel.last, `is`(cryptoQuoteResponseParcelable!!.last))
50 | assertThat(createdFromParcel.volume, `is`(cryptoQuoteResponseParcelable!!.volume))
51 | assertThat(createdFromParcel.dateTime, `is`(cryptoQuoteResponseParcelable!!.dateTime))
52 | assertThat(createdFromParcel.dayLow, `is`(cryptoQuoteResponseParcelable!!.dayLow))
53 | assertThat(createdFromParcel.dayHigh, `is`(cryptoQuoteResponseParcelable!!.dayHigh))
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItErrorResultParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.filters.SmallTest
5 | import android.support.test.runner.AndroidJUnit4
6 |
7 | import org.junit.Before
8 | import org.junit.Test
9 | import org.junit.runner.RunWith
10 |
11 | import java.util.Arrays
12 |
13 | import it.trade.model.reponse.TradeItErrorCode
14 |
15 | import org.hamcrest.Matchers.`is`
16 | import org.junit.Assert.assertThat
17 |
18 | @RunWith(AndroidJUnit4::class)
19 | @SmallTest
20 | class TradeItErrorResultParcelableTest {
21 |
22 | private var errorResult: TradeItErrorResultParcelable? = null
23 |
24 | @Before
25 | fun createTradeItErrorResult() {
26 | errorResult = TradeItErrorResultParcelable()
27 | }
28 |
29 | @Test
30 | fun errorResult_ParcelableWriteRead() {
31 | // Set up the Parcelable object to send and receive.
32 | errorResult!!.errorCode = TradeItErrorCode.BROKER_ACCOUNT_ERROR
33 | errorResult!!.httpCode = 400
34 | errorResult!!.longMessages = Arrays.asList("Error1", "Error2")
35 | errorResult!!.shortMessage = "MyShortMessage"
36 | errorResult!!.systemMessage = "MySystemMessage"
37 |
38 | // Write the data.
39 | val parcel = Parcel.obtain()
40 | errorResult!!.writeToParcel(parcel, errorResult!!.describeContents())
41 |
42 | // After you're done with writing, you need to reset the parcel for reading.
43 | parcel.setDataPosition(0)
44 |
45 | // Read the data.
46 | val createdFromParcel = TradeItErrorResultParcelable.CREATOR.createFromParcel(parcel)
47 | val errorCode = createdFromParcel.errorCode
48 | val httpCode = createdFromParcel.httpCode
49 | val longMessages = createdFromParcel.longMessages
50 | val shortMessage = createdFromParcel.shortMessage
51 | val systemMessage = createdFromParcel.systemMessage
52 |
53 | // Verify that the received data is correct.
54 | assertThat(errorCode, `is`(errorResult!!.errorCode))
55 | assertThat(httpCode, `is`(errorResult!!.httpCode))
56 | assertThat(longMessages, `is`(errorResult!!.longMessages))
57 | assertThat(shortMessage, `is`(errorResult!!.shortMessage))
58 | assertThat(systemMessage, `is`(errorResult!!.systemMessage))
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItOrderStatusParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.InstrumentationRegistry
5 | import android.support.test.filters.SmallTest
6 | import android.support.test.runner.AndroidJUnit4
7 | import it.trade.android.sdk.TradeItConfigurationBuilder
8 | import it.trade.android.sdk.TradeItSDK
9 | import it.trade.android.sdk.model.orderstatus.TradeItOrderLegParcelable
10 | import it.trade.android.sdk.model.orderstatus.TradeItOrderStatusParcelable
11 | import it.trade.model.reponse.OrderLeg
12 | import it.trade.model.reponse.OrderStatusDetails
13 | import it.trade.model.reponse.PriceInfo
14 | import it.trade.model.request.TradeItEnvironment
15 | import org.hamcrest.Matchers.`is`
16 | import org.junit.Assert.assertThat
17 | import org.junit.Before
18 | import org.junit.Test
19 | import org.junit.runner.RunWith
20 |
21 | @RunWith(AndroidJUnit4::class)
22 | @SmallTest
23 | class TradeItOrderStatusParcelableTest {
24 |
25 | private var orderStatusParcelable: TradeItOrderStatusParcelable? = null
26 |
27 | @Before
28 | fun createTradeItOrder() {
29 | val instrumentationCtx = InstrumentationRegistry.getTargetContext()
30 | TradeItSDK.clearConfig()
31 | TradeItSDK.configure(TradeItConfigurationBuilder(instrumentationCtx.applicationContext, "tradeit-test-api-key", TradeItEnvironment.QA))
32 |
33 | val orderStatusDetails = OrderStatusDetails()
34 | orderStatusDetails.orderExpiration = "GTC"
35 | orderStatusDetails.orderType = "EQUITY_OR_ETF"
36 | orderStatusDetails.orderStatus = "OPEN"
37 | orderStatusDetails.orderNumber = "1"
38 | val orderLeg = OrderLeg()
39 | orderLeg.symbol = "GE"
40 | orderLeg.filledQuantity = 0.0
41 | orderLeg.orderedQuantity = 10.0
42 | orderLeg.action = "BUY"
43 | val priceInfo = PriceInfo()
44 | priceInfo.type = "LIMIT"
45 | priceInfo.limitPrice = 20.3
46 | orderLeg.priceInfo = priceInfo
47 | orderStatusDetails.orderLegs.add(orderLeg)
48 |
49 | orderStatusParcelable = TradeItOrderStatusParcelable(orderStatusDetails)
50 | }
51 |
52 | @Test
53 | fun order_ParcelableWriteRead() {
54 |
55 | // Write the data.
56 | val parcel = Parcel.obtain()
57 | orderStatusParcelable!!.writeToParcel(parcel, orderStatusParcelable!!.describeContents())
58 |
59 | // After you're done with writing, you need to reset the parcel for reading.
60 | parcel.setDataPosition(0)
61 |
62 | // Read the data.
63 | val createdFromParcel = TradeItOrderStatusParcelable.CREATOR.createFromParcel(parcel)
64 |
65 | // Verify that the received data is correct.
66 | assertThat(createdFromParcel.groupOrderId, `is`(orderStatusParcelable!!.groupOrderId))
67 | assertThat(createdFromParcel.groupOrders, `is`(orderStatusParcelable!!.groupOrders))
68 | assertThat(createdFromParcel.groupOrderType, `is`(orderStatusParcelable!!.groupOrderType))
69 | assertThat(createdFromParcel.orderExpiration, `is`(orderStatusParcelable!!.orderExpiration))
70 | assertThat>(createdFromParcel.orderLegs, `is`>(orderStatusParcelable!!.orderLegs))
71 | assertThat(createdFromParcel.orderNumber, `is`(orderStatusParcelable!!.orderNumber))
72 | assertThat(createdFromParcel.orderStatus, `is`(orderStatusParcelable!!.orderStatus))
73 | assertThat(createdFromParcel.orderType, `is`(orderStatusParcelable!!.orderType))
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItPlaceStockOrEtfOrderResponseParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.filters.SmallTest
5 | import android.support.test.runner.AndroidJUnit4
6 | import org.hamcrest.Matchers.`is`
7 | import org.junit.Assert.assertThat
8 | import org.junit.Before
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 |
12 | @RunWith(AndroidJUnit4::class)
13 | @SmallTest
14 | class TradeItPlaceStockOrEtfOrderResponseParcelableTest {
15 | private var placeOrderResponse: TradeItPlaceStockOrEtfOrderResponseParcelable? = null
16 |
17 | @Before
18 | fun createTradeItPreviewStockOrEtfOrder() {
19 | placeOrderResponse = TradeItPlaceStockOrEtfOrderResponseParcelable()
20 | }
21 |
22 | @Test
23 | fun tradeItPreviewStockOrEtfOrder_ParcelableWriteRead() {
24 | // Set up the Parcelable object to send and receive.
25 | placeOrderResponse!!.orderNumber = "MyOrderId"
26 | placeOrderResponse!!.confirmationMessage = "MyConfirmationMessage"
27 | placeOrderResponse!!.broker = "MyBroker"
28 | placeOrderResponse!!.timestamp = "My time stamp"
29 | placeOrderResponse!!.orderInfo = TradeItOrderInfoParcelable()
30 | placeOrderResponse!!.orderInfo?.expiration = "MyExpiration"
31 | placeOrderResponse!!.orderInfo?.symbol = "MySymbol"
32 | placeOrderResponse!!.orderInfo?.quantity = 4.0
33 | placeOrderResponse!!.orderInfo?.price = TradeItPriceParcelable()
34 | placeOrderResponse!!.orderInfo?.price?.ask = 20.5
35 |
36 | // Write the data.
37 | val parcel = Parcel.obtain()
38 | placeOrderResponse!!.writeToParcel(parcel, placeOrderResponse!!.describeContents())
39 |
40 | // After you're done with writing, you need to reset the parcel for reading.
41 | parcel.setDataPosition(0)
42 |
43 | // Read the data.
44 | val createdFromParcel = TradeItPlaceStockOrEtfOrderResponseParcelable.CREATOR.createFromParcel(parcel)
45 | val orderInfoParcelable = createdFromParcel.orderInfo
46 | val broker = createdFromParcel.broker
47 | val confirmationMessage = createdFromParcel.confirmationMessage
48 | val timestamp = createdFromParcel.timestamp
49 | val orderNumber = createdFromParcel.orderNumber
50 |
51 | // Verify that the received data is correct.
52 | assertThat(orderNumber, `is`(placeOrderResponse!!.orderNumber))
53 | assertThat(timestamp, `is`(placeOrderResponse!!.timestamp))
54 | assertThat(broker, `is`(placeOrderResponse!!.broker))
55 | assertThat(confirmationMessage, `is`(placeOrderResponse!!.confirmationMessage))
56 | assertThat(orderInfoParcelable?.action, `is`(placeOrderResponse!!.orderInfo?.action))
57 | assertThat(orderInfoParcelable?.price?.ask, `is`(placeOrderResponse!!.orderInfo?.price?.ask))
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItPreviewCryptoOrderResponseParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.runner.AndroidJUnit4
5 | import android.test.suitebuilder.annotation.SmallTest
6 | import it.trade.model.reponse.Warning
7 | import it.trade.model.reponse.WarningLink
8 | import org.hamcrest.Matchers.`is`
9 | import org.junit.Assert.assertThat
10 | import org.junit.Before
11 | import org.junit.Test
12 | import org.junit.runner.RunWith
13 | import java.util.*
14 |
15 | @RunWith(AndroidJUnit4::class)
16 | @SmallTest
17 | class TradeItPreviewCryptoOrderResponseParcelableTest {
18 | protected var previewCryptoOrderResponse: TradeItPreviewCryptoOrderResponseParcelable? = null
19 |
20 | @Before
21 | fun createTradeItPreviewCryptoOrder() {
22 | previewCryptoOrderResponse = TradeItPreviewCryptoOrderResponseParcelable()
23 | }
24 |
25 | @Test
26 | fun tradeItPreviewCryptoOrder_ParcelableWriteRead() {
27 | val link = WarningLink()
28 | link.label = "Label"
29 | link.url = "URL"
30 |
31 | val warning = Warning()
32 | warning.message = "Warning"
33 | warning.requiresAcknowledgement = true
34 | warning.links = Arrays.asList(link)
35 |
36 | val warningParcelable = TradeItWarningParcelable(warning)
37 |
38 | // Set up the Parcelable object to send and receive.
39 | previewCryptoOrderResponse?.orderId = "MyOrderId"
40 | previewCryptoOrderResponse?.orderDetails = TradeItCryptoPreviewOrderDetailsParcelable()
41 | previewCryptoOrderResponse?.orderDetails?.orderPair = "MyOrderPair"
42 | previewCryptoOrderResponse?.orderDetails?.orderQuantityType = "MyOrderquantityType"
43 | previewCryptoOrderResponse?.orderDetails?.orderCommissionLabel = "MyOrderCommissionLabel"
44 | previewCryptoOrderResponse?.orderDetails?.orderQuantity = 100.0
45 | previewCryptoOrderResponse?.orderDetails?.warnings = Arrays.asList(warningParcelable)
46 |
47 | // Write the data.
48 | val parcel = Parcel.obtain()
49 | previewCryptoOrderResponse?.writeToParcel(parcel, previewCryptoOrderResponse?.describeContents()!!)
50 |
51 | // After you're done with writing, you need to reset the parcel for reading.
52 | parcel.setDataPosition(0)
53 |
54 | // Read the data.
55 | val createdFromParcel = TradeItPreviewCryptoOrderResponseParcelable.CREATOR.createFromParcel(parcel)
56 | val orderDetailsParcelable = createdFromParcel.orderDetails
57 | val warnings = createdFromParcel.orderDetails?.warnings
58 |
59 | val orderId = createdFromParcel.orderId
60 |
61 | // Verify that the received data is correct.
62 | assertThat(orderId, `is`(previewCryptoOrderResponse?.orderId))
63 | assertThat(orderDetailsParcelable?.orderPair, `is`(previewCryptoOrderResponse?.orderDetails?.orderPair))
64 | assertThat(orderDetailsParcelable?.orderQuantity, `is`(previewCryptoOrderResponse?.orderDetails?.orderQuantity))
65 | assertThat(orderDetailsParcelable?.orderQuantityType, `is`(previewCryptoOrderResponse?.orderDetails?.orderQuantityType))
66 | assertThat(orderDetailsParcelable?.orderCommissionLabel, `is`(previewCryptoOrderResponse?.orderDetails?.orderCommissionLabel))
67 | assertThat(warnings, `is`(previewCryptoOrderResponse?.orderDetails?.warnings))
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItPreviewStockOrEtfOrderResponseParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.filters.SmallTest
5 | import android.support.test.runner.AndroidJUnit4
6 | import it.trade.model.reponse.Warning
7 | import it.trade.model.reponse.WarningLink
8 | import org.hamcrest.Matchers.`is`
9 | import org.junit.Assert.assertThat
10 | import org.junit.Before
11 | import org.junit.Test
12 | import org.junit.runner.RunWith
13 | import java.util.*
14 |
15 | @RunWith(AndroidJUnit4::class)
16 | @SmallTest
17 | class TradeItPreviewStockOrEtfOrderResponseParcelableTest {
18 | protected var previewOrderResponse: TradeItPreviewStockOrEtfOrderResponseParcelable? = null
19 |
20 | @Before
21 | fun createTradeItPreviewStockOrEtfOrder() {
22 | previewOrderResponse = TradeItPreviewStockOrEtfOrderResponseParcelable()
23 | }
24 |
25 | @Test
26 | fun tradeItPreviewStockOrEtfOrder_ParcelableWriteRead() {
27 | val link = WarningLink()
28 | link.label = "Label"
29 | link.url = "URL"
30 |
31 | val warning = Warning()
32 | warning.message = "Warning"
33 | warning.requiresAcknowledgement = true
34 | warning.links = Arrays.asList(link)
35 |
36 | val warningParcelable = TradeItWarningParcelable(warning)
37 |
38 | // Set up the Parcelable object to send and receive.
39 | previewOrderResponse?.orderId = "MyOrderId"
40 | previewOrderResponse?.ackWarningsList = Arrays.asList("MyAckWarning")
41 | previewOrderResponse?.warningsList = Arrays.asList("MyWarningList")
42 | previewOrderResponse?.orderDetails = TradeItOrderDetailsParcelable()
43 | previewOrderResponse?.orderDetails?.orderSymbol = "GE"
44 | previewOrderResponse?.orderDetails?.orderCommissionLabel = "MyOrderCommissionLabel"
45 | previewOrderResponse?.orderDetails?.warnings = Arrays.asList(warningParcelable)
46 | // Write the data.
47 | val parcel = Parcel.obtain()
48 | previewOrderResponse?.writeToParcel(parcel, previewOrderResponse?.describeContents()!!)
49 |
50 | // After you're done with writing, you need to reset the parcel for reading.
51 | parcel.setDataPosition(0)
52 |
53 | // Read the data.
54 | val createdFromParcel = TradeItPreviewStockOrEtfOrderResponseParcelable.CREATOR.createFromParcel(parcel)
55 | val orderDetailsParcelable = createdFromParcel.orderDetails
56 | val ackWarningsList = createdFromParcel.ackWarningsList
57 | val warningsList = createdFromParcel.warningsList
58 | val warnings = createdFromParcel.orderDetails?.warnings
59 |
60 | val orderId = createdFromParcel.orderId
61 |
62 | // Verify that the received data is correct.
63 | assertThat(orderId, `is`(previewOrderResponse?.orderId))
64 | assertThat(ackWarningsList, `is`(previewOrderResponse?.ackWarningsList))
65 | assertThat(warningsList, `is`(previewOrderResponse?.warningsList))
66 | assertThat(orderDetailsParcelable?.orderSymbol, `is`(previewOrderResponse?.orderDetails?.orderSymbol))
67 | assertThat(orderDetailsParcelable?.orderCommissionLabel, `is`(previewOrderResponse?.orderDetails?.orderCommissionLabel))
68 | assertThat(warnings, `is`(previewOrderResponse?.orderDetails?.warnings))
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/androidTest/kotlin/it/trade/android/sdk/model/TradeItSecurityQuestionParcelableTest.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.support.test.filters.SmallTest
5 | import android.support.test.runner.AndroidJUnit4
6 | import org.hamcrest.Matchers.`is`
7 | import org.junit.Assert.assertThat
8 | import org.junit.Before
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 | import java.util.*
12 |
13 | @RunWith(AndroidJUnit4::class)
14 | @SmallTest
15 | class TradeItSecurityQuestionParcelableTest {
16 |
17 | private var tradeItSecurityQuestion: TradeItSecurityQuestionParcelable? = null
18 |
19 | @Before
20 | fun createTradeItSecurityQuestion() {
21 | tradeItSecurityQuestion = TradeItSecurityQuestionParcelable("My security question", Arrays.asList("option1", "option2", "option3"))
22 | }
23 |
24 | @Test
25 | fun securityQuestion_ParcelableWriteRead() {
26 | val parcel = Parcel.obtain()
27 | tradeItSecurityQuestion!!.writeToParcel(parcel, tradeItSecurityQuestion!!.describeContents())
28 |
29 | // After you're done with writing, you need to reset the parcel for reading.
30 | parcel.setDataPosition(0)
31 |
32 | // Read the data.
33 | val createdFromParcel = TradeItSecurityQuestionParcelable.CREATOR.createFromParcel(parcel)
34 | val securityQuestion = createdFromParcel.securityQuestion
35 | val securityQuestionOptions = createdFromParcel.securityQuestionOptions
36 |
37 | assertThat(securityQuestion, `is`(tradeItSecurityQuestion!!.securityQuestion))
38 | assertThat(securityQuestionOptions, `is`(tradeItSecurityQuestion!!.securityQuestionOptions))
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/TradeItConfigurationBuilder.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk
2 |
3 | import android.content.Context
4 |
5 | import it.trade.android.sdk.model.RequestInterceptorParcelable
6 | import it.trade.model.request.TradeItEnvironment
7 |
8 | class TradeItConfigurationBuilder (
9 | val context: Context,
10 | val apiKey: String,
11 | val environment: TradeItEnvironment
12 | ) {
13 |
14 | var baseUrl: String? = null
15 | private set
16 | var requestInterceptorParcelable: RequestInterceptorParcelable? = null
17 | private set
18 | var isPrefetchBrokerListEnabled = true
19 | private set
20 |
21 | fun withBaseUrl(baseUrl: String): TradeItConfigurationBuilder {
22 | this.baseUrl = baseUrl
23 | return this
24 | }
25 |
26 | fun withRequestInterceptor(requestInterceptorParcelable: RequestInterceptorParcelable): TradeItConfigurationBuilder {
27 | this.requestInterceptorParcelable = requestInterceptorParcelable
28 | return this
29 | }
30 |
31 | fun disablePrefetchBrokerList(): TradeItConfigurationBuilder {
32 | this.isPrefetchBrokerListEnabled = false
33 | return this
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/TradeItSDK.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk
2 |
3 |
4 | import android.util.Log
5 |
6 | import it.trade.android.sdk.exceptions.TradeItSDKConfigurationException
7 | import it.trade.android.sdk.manager.TradeItLinkedBrokerManager
8 | import it.trade.android.sdk.model.TradeItLinkedBrokerCache
9 | import it.trade.model.request.TradeItEnvironment
10 |
11 |
12 | object TradeItSDK {
13 | private var instance: TradeItSdkInstance? = null
14 |
15 | @JvmStatic
16 | val linkedBrokerManager: TradeItLinkedBrokerManager
17 | @Throws(TradeItSDKConfigurationException::class)
18 | get() {
19 | if (instance == null) {
20 | throw TradeItSDKConfigurationException("ERROR: TradeItSDK.linkedBrokerManager referenced before calling TradeItSDK.configure()!")
21 | }
22 | return instance!!.linkedBrokerManager!!
23 | }
24 |
25 | val environment: TradeItEnvironment?
26 | get() {
27 | if (instance == null) {
28 | throw TradeItSDKConfigurationException("ERROR: TradeItSDK.linkedBrokerManager referenced before calling TradeItSDK.configure()!")
29 | }
30 | return instance!!.environment
31 | }
32 |
33 | val linkedBrokerCache: TradeItLinkedBrokerCache?
34 | get() {
35 | if (instance == null) {
36 | throw TradeItSDKConfigurationException("ERROR: TradeItSDK.linkedBrokerCache referenced before calling TradeItSDK.configure()!")
37 | }
38 | return instance!!.linkedBrokerCache
39 | }
40 |
41 |
42 | @JvmStatic
43 | fun configure(configurationBuilder: TradeItConfigurationBuilder) {
44 | if (instance == null) {
45 | instance = TradeItSdkInstance(configurationBuilder)
46 | } else {
47 | Log.w("TradeItSDK", "Warning: TradeItSDK.configure() called multiple times. Ignoring.")
48 | }
49 | }
50 |
51 | fun clearConfig() {
52 | instance = null
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/TradeItSdkInstance.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk
2 |
3 | import it.trade.android.sdk.exceptions.TradeItKeystoreServiceCreateKeyException
4 | import it.trade.android.sdk.exceptions.TradeItRetrieveLinkedLoginException
5 | import it.trade.android.sdk.exceptions.TradeItSDKConfigurationException
6 | import it.trade.android.sdk.internal.TradeItKeystoreService
7 | import it.trade.android.sdk.manager.TradeItLinkedBrokerManager
8 | import it.trade.android.sdk.model.TradeItApiClientParcelable
9 | import it.trade.android.sdk.model.TradeItLinkedBrokerCache
10 | import it.trade.model.request.TradeItEnvironment
11 |
12 |
13 | class TradeItSdkInstance(configurationBuilder: TradeItConfigurationBuilder) {
14 | var environment: TradeItEnvironment? = null
15 | private set
16 | var linkedBrokerManager: TradeItLinkedBrokerManager? = null
17 | private set
18 | var linkedBrokerCache: TradeItLinkedBrokerCache? = null
19 | private set
20 | private var keyStoreService: TradeItKeystoreService? = null
21 |
22 | init {
23 | val baseUrl = configurationBuilder.baseUrl
24 | if (baseUrl != null && !baseUrl.isEmpty()) {
25 | configurationBuilder.environment.baseUrl = baseUrl
26 | }
27 | initializeTradeItSdkInstance(configurationBuilder)
28 | }
29 |
30 | private fun initializeTradeItSdkInstance(configurationBuilder: TradeItConfigurationBuilder) {
31 | this.environment = configurationBuilder.environment
32 | this.linkedBrokerCache = TradeItLinkedBrokerCache(configurationBuilder.context)
33 |
34 | try {
35 | this.keyStoreService = TradeItKeystoreService(configurationBuilder.context)
36 | } catch (e: TradeItKeystoreServiceCreateKeyException) {
37 | throw TradeItSDKConfigurationException("Error initializing TradeItKeystoreService: ", e)
38 | }
39 |
40 | try {
41 | linkedBrokerManager = TradeItLinkedBrokerManager(
42 | TradeItApiClientParcelable(
43 | configurationBuilder.apiKey,
44 | environment!!,
45 | configurationBuilder.requestInterceptorParcelable
46 | ),
47 | linkedBrokerCache!!,
48 | keyStoreService!!,
49 | configurationBuilder.isPrefetchBrokerListEnabled
50 | )
51 | } catch (e: TradeItRetrieveLinkedLoginException) {
52 | throw TradeItSDKConfigurationException("Error initializing TradeItLinkedBrokerManager: ", e)
53 | }
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/enums/TradeItOrderAction.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.enums
2 |
3 | enum class TradeItOrderAction private constructor(val actionValue: String) {
4 | BUY("buy"),
5 | SELL("sell"),
6 | BUY_TO_COVER("buyToCover"),
7 | SELL_SHORT("sellShort");
8 |
9 |
10 | companion object {
11 |
12 | fun getActionForValue(actionValue: String): TradeItOrderAction? {
13 | for (action in TradeItOrderAction.values()) {
14 | if (action.actionValue == actionValue) {
15 | return action
16 | }
17 | }
18 | return null
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/enums/TradeItOrderExpirationType.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.enums
2 |
3 | enum class TradeItOrderExpirationType private constructor(val expirationValue: String) {
4 | GOOD_FOR_DAY("day"),
5 | GOOD_UNTIL_CANCELED("gtc");
6 |
7 |
8 | companion object {
9 |
10 |
11 | fun getExpirationForValue(actionValue: String): TradeItOrderExpirationType? {
12 | for (expiration in TradeItOrderExpirationType.values()) {
13 | if (expiration.expirationValue == actionValue) {
14 | return expiration
15 | }
16 | }
17 | return null
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/enums/TradeItOrderPriceType.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.enums
2 |
3 |
4 | enum class TradeItOrderPriceType private constructor(val priceTypeValue: String) {
5 | MARKET("market"),
6 | LIMIT("limit"),
7 | STOP_MARKET("stopMarket"),
8 | STOP_LIMIT("stopLimit");
9 |
10 |
11 | companion object {
12 |
13 | fun getPriceTypeForValue(actionValue: String): TradeItOrderPriceType? {
14 | for (priceType in TradeItOrderPriceType.values()) {
15 | if (priceType.priceTypeValue == actionValue) {
16 | return priceType
17 | }
18 | }
19 | return null
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/enums/TradeItOrderQuantityType.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.enums
2 |
3 | enum class TradeItOrderQuantityType(val value: String) {
4 | QUOTE_CURRENCY("QUOTE_CURRENCY"),
5 | BASE_CURRENCY("BASE_CURRENCY"),
6 | SHARES("SHARES"),
7 | TOTAL_PRICE("TOTAL_PRICE")
8 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItDeleteLinkedLoginException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItDeleteLinkedLoginException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItKeystoreServiceCreateKeyException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItKeystoreServiceCreateKeyException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItKeystoreServiceDecryptException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItKeystoreServiceDecryptException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItKeystoreServiceDeleteKeyException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 |
4 | class TradeItKeystoreServiceDeleteKeyException(message: String, t: Throwable) : Exception(message, t)
5 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItKeystoreServiceEncryptException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 |
4 | class TradeItKeystoreServiceEncryptException(message: String, t: Throwable) : Exception(message, t)
5 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItRetrieveLinkedLoginException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItRetrieveLinkedLoginException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItSDKConfigurationException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItSDKConfigurationException : RuntimeException {
4 |
5 | constructor(detailMessage: String) : super(detailMessage) {}
6 |
7 | constructor(detailMessage: String, throwable: Throwable) : super(detailMessage, throwable) {}
8 | }
9 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItSaveLinkedLoginException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItSaveLinkedLoginException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/exceptions/TradeItUpdateLinkedLoginException.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.exceptions
2 |
3 | class TradeItUpdateLinkedLoginException(message: String, t: Throwable) : Exception(message, t)
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/internal/LinkedBrokersParcelableList.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.internal
2 |
3 | import it.trade.android.sdk.model.TradeItLinkedBrokerParcelable
4 | import java.util.*
5 |
6 |
7 | class LinkedBrokersParcelableList(linkedBrokers: List) : ArrayList() {
8 |
9 | init {
10 | this.addAll(linkedBrokers)
11 | }
12 |
13 | fun containsSameAccounts(linkedBrokerParcelable: TradeItLinkedBrokerParcelable): Boolean {
14 | return this.any {
15 | it == linkedBrokerParcelable && it.equalsAccounts(linkedBrokerParcelable)
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/RequestInterceptorParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcelable
4 |
5 | import okhttp3.Interceptor
6 |
7 | abstract class RequestInterceptorParcelable : Interceptor, Parcelable
8 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/SymbolPairParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | class SymbolPairParcelable(val baseSymbol: String, val quoteSymbol: String) : Parcelable {
7 | override fun toString(): String {
8 | return "SymbolPairParcelable(baseSymbol='$baseSymbol', quoteSymbol='$quoteSymbol')"
9 | }
10 |
11 | constructor(source: Parcel) : this(
12 | source.readString(),
13 | source.readString()
14 | )
15 |
16 | override fun describeContents() = 0
17 |
18 | override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
19 | writeString(baseSymbol)
20 | writeString(quoteSymbol)
21 | }
22 |
23 | companion object {
24 | @JvmField
25 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
26 | override fun createFromParcel(source: Parcel): SymbolPairParcelable = SymbolPairParcelable(source)
27 | override fun newArray(size: Int): Array = arrayOfNulls(size)
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItApiClientParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Build
4 | import android.os.Parcel
5 | import android.os.Parcelable
6 | import it.trade.api.StatelessTradeItApiClient
7 | import it.trade.api.TradeItApiClient
8 | import it.trade.model.request.TradeItEnvironment
9 |
10 | class TradeItApiClientParcelable : TradeItApiClient, Parcelable {
11 |
12 | var requestInterceptorParcelable: RequestInterceptorParcelable? = null
13 | private set
14 |
15 | @JvmOverloads constructor(
16 | apiKey: String,
17 | environment: TradeItEnvironment,
18 | requestInterceptorParcelable: RequestInterceptorParcelable? = null
19 | ) : super(apiKey, environment, requestInterceptorParcelable, forceTLS12()) {
20 | this.requestInterceptorParcelable = requestInterceptorParcelable
21 | }
22 |
23 | protected constructor(
24 | apiKey: String,
25 | statelessTradeItApiClient: StatelessTradeItApiClient
26 | ) : super(apiKey, statelessTradeItApiClient) {}
27 |
28 | override fun describeContents(): Int {
29 | return 0
30 | }
31 |
32 | override fun writeToParcel(dest: Parcel, flags: Int) {
33 | dest.writeParcelable(this.requestInterceptorParcelable, flags)
34 | dest.writeString(this.serverUuid)
35 | dest.writeString(this.sessionToken)
36 | dest.writeInt(if (this.environment == null) -1 else this.environment.ordinal)
37 | dest.writeString(this.apiKey)
38 | }
39 |
40 | protected constructor(`in`: Parcel) {
41 | this.requestInterceptorParcelable = `in`.readParcelable(RequestInterceptorParcelable::class.java.getClassLoader())
42 | this.serverUuid = `in`.readString()
43 | this.sessionToken = `in`.readString()
44 | val tmpEnvironment = `in`.readInt()
45 | this.environment = if (tmpEnvironment == -1) null else TradeItEnvironment.values()[tmpEnvironment]
46 | this.apiKey = `in`.readString()
47 | this.statelessTradeItApiClient = this.createStatelessTradeItApiClient(
48 | environment,
49 | requestInterceptorParcelable,
50 | forceTLS12()
51 | );
52 | }
53 |
54 | companion object {
55 | @JvmField
56 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
57 | override fun createFromParcel(source: Parcel): TradeItApiClientParcelable {
58 | return TradeItApiClientParcelable(source)
59 | }
60 |
61 | override fun newArray(size: Int): Array {
62 | return arrayOfNulls(size)
63 | }
64 | }
65 |
66 | private fun forceTLS12(): Boolean {
67 | return Build.VERSION.SDK_INT >= 16 && Build.VERSION.SDK_INT < 22
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItCallBackCompletion.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | interface TradeItCallBackCompletion {
4 | fun onFinished()
5 | }
6 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItCallbackWithSecurityQuestionAndCompletion.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import it.trade.model.TradeItSecurityQuestion
4 | import it.trade.model.callback.TradeItCallbackWithSecurityQuestionImpl
5 |
6 |
7 | interface TradeItCallbackWithSecurityQuestionAndCompletion : TradeItCallBackCompletion {
8 | fun onSecurityQuestion(
9 | securityQuestion: TradeItSecurityQuestion,
10 | callback: TradeItCallbackWithSecurityQuestionImpl<*>
11 | )
12 | }
13 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItCryptoQuoteResponseParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.TradeItCryptoQuoteResponse
6 | import java.math.BigDecimal
7 |
8 | class TradeItCryptoQuoteResponseParcelable : Parcelable {
9 |
10 | var ask: BigDecimal? = null
11 | var bid: BigDecimal? = null
12 | var last: BigDecimal? = null
13 | var open: BigDecimal? = null
14 | var dayHigh: BigDecimal? = null
15 | var dayLow: BigDecimal? = null
16 | var volume: BigDecimal? = null
17 | var dateTime: String? = null
18 |
19 | internal constructor() {}
20 |
21 | internal constructor(cryptoQuote: TradeItCryptoQuoteResponse) {
22 | this.ask = cryptoQuote.ask
23 | this.bid = cryptoQuote.bid
24 | this.last = cryptoQuote.last
25 | this.open = cryptoQuote.open
26 | this.dayHigh = cryptoQuote.dayHigh
27 | this.dayLow = cryptoQuote.dayLow
28 | this.volume = cryptoQuote.volume
29 | this.dateTime = cryptoQuote.dateTime
30 | }
31 |
32 | constructor(parcel: Parcel) {
33 | ask = parcel.readSerializable() as? BigDecimal
34 | bid = parcel.readSerializable() as? BigDecimal
35 | last = parcel.readSerializable() as? BigDecimal
36 | open = parcel.readSerializable() as? BigDecimal
37 | dayHigh = parcel.readSerializable() as? BigDecimal
38 | dayLow = parcel.readSerializable() as? BigDecimal
39 | volume = parcel.readSerializable() as? BigDecimal
40 | dateTime = parcel.readString()
41 | }
42 |
43 | override fun toString(): String {
44 | return "TradeItCryptoQuoteResponseParcelable(" +
45 | "ask=$ask, " +
46 | "bid=$bid, " +
47 | "last=$last, " +
48 | "open=$open, " +
49 | "dayHigh=$dayHigh, " +
50 | "dayLow=$dayLow, " +
51 | "volume=$volume, " +
52 | "dateTime=$dateTime" +
53 | ")"
54 | }
55 |
56 | override fun writeToParcel(parcel: Parcel, flags: Int) {
57 | parcel.writeSerializable(ask)
58 | parcel.writeSerializable(bid)
59 | parcel.writeSerializable(last)
60 | parcel.writeSerializable(open)
61 | parcel.writeSerializable(dayHigh)
62 | parcel.writeSerializable(dayLow)
63 | parcel.writeSerializable(volume)
64 | parcel.writeString(dateTime)
65 | }
66 |
67 | override fun describeContents(): Int {
68 | return 0
69 | }
70 |
71 | companion object {
72 | @JvmField
73 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
74 | override fun createFromParcel(source: Parcel): TradeItCryptoQuoteResponseParcelable = TradeItCryptoQuoteResponseParcelable(source)
75 | override fun newArray(size: Int): Array = arrayOfNulls(size)
76 | }
77 | }
78 |
79 |
80 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItCryptoTradeOrderDetailsParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.CryptoTradeOrderDetails
6 |
7 | class TradeItCryptoTradeOrderDetailsParcelable : Parcelable {
8 |
9 | var orderLimitPrice: Double? = null
10 | var orderStopPrice: Double? = null
11 | var orderExpiration: String = ""
12 | var orderAction: String = ""
13 | var orderPair: String = ""
14 | var orderPriceType: String = ""
15 | var orderQuantity: Double = 0.0
16 | var orderQuantityType: String = ""
17 |
18 | constructor(parcel: Parcel) {
19 | orderLimitPrice = parcel.readValue(Double::class.java.classLoader) as? Double
20 | orderStopPrice = parcel.readValue(Double::class.java.classLoader) as? Double
21 | orderExpiration = parcel.readString()
22 | orderAction = parcel.readString()
23 | orderPair = parcel.readString()
24 | orderPriceType = parcel.readString()
25 | orderQuantity = parcel.readDouble()
26 | orderQuantityType = parcel.readString()
27 | }
28 |
29 | internal constructor() {}
30 |
31 | internal constructor(cryptoTradeOrderDetails: CryptoTradeOrderDetails) {
32 | this.orderLimitPrice = cryptoTradeOrderDetails.orderLimitPrice
33 | this.orderStopPrice = cryptoTradeOrderDetails.orderStopPrice
34 | this.orderExpiration = cryptoTradeOrderDetails.orderExpiration
35 | this.orderAction = cryptoTradeOrderDetails.orderAction
36 | this.orderPair = cryptoTradeOrderDetails.orderPair
37 | this.orderPriceType = cryptoTradeOrderDetails.orderPriceType
38 | this.orderQuantity = cryptoTradeOrderDetails.orderQuantity
39 | this.orderQuantityType = cryptoTradeOrderDetails.orderQuantityType
40 | }
41 |
42 | override fun toString(): String {
43 | return "TradeItCryptoTradeOrderDetailsParcelable(" +
44 | "orderLimitPrice=$orderLimitPrice, " +
45 | "orderStopPrice=$orderStopPrice, " +
46 | "orderExpiration='$orderExpiration', " +
47 | "orderAction='$orderAction', " +
48 | "orderPair='$orderPair', " +
49 | "orderPriceType='$orderPriceType', " +
50 | "orderQuantity=$orderQuantity, " +
51 | "orderQuantityType='$orderQuantityType')"
52 | }
53 |
54 | override fun writeToParcel(parcel: Parcel, flags: Int) {
55 | parcel.writeValue(orderLimitPrice)
56 | parcel.writeValue(orderStopPrice)
57 | parcel.writeString(orderExpiration)
58 | parcel.writeString(orderAction)
59 | parcel.writeString(orderPair)
60 | parcel.writeString(orderPriceType)
61 | parcel.writeDouble(orderQuantity)
62 | parcel.writeString(orderQuantityType)
63 | }
64 |
65 | override fun describeContents(): Int {
66 | return 0
67 | }
68 |
69 | companion object {
70 | @JvmField
71 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
72 | override fun createFromParcel(source: Parcel): TradeItCryptoTradeOrderDetailsParcelable = TradeItCryptoTradeOrderDetailsParcelable(source)
73 | override fun newArray(size: Int): Array = arrayOfNulls(size)
74 | }
75 | }
76 |
77 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItErrorResultParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.TradeItErrorResult
7 | import it.trade.model.reponse.TradeItErrorCode
8 |
9 | class TradeItErrorResultParcelable : TradeItErrorResult, Parcelable {
10 |
11 | constructor(errorResult: TradeItErrorResult) {
12 | this.shortMessage = errorResult.shortMessage
13 | this.longMessages = errorResult.longMessages
14 | this.systemMessage = errorResult.systemMessage
15 | this.errorCode = errorResult.errorCode
16 | this.httpCode = errorResult.httpCode
17 | }
18 |
19 | constructor(throwable: Throwable) {
20 | this.systemMessage = throwable.message
21 | }
22 |
23 | constructor(
24 | errorCode: TradeItErrorCode,
25 | shortMessage: String,
26 | longMessages: List
27 | ) : super(errorCode, shortMessage, longMessages) {}
28 |
29 | constructor(title: String, message: String) : super(title, message) {}
30 |
31 | override fun describeContents(): Int {
32 | return 0
33 | }
34 |
35 | override fun writeToParcel(dest: Parcel, flags: Int) {
36 | dest.writeInt(if (this.errorCode == null) -1 else this.errorCode.ordinal)
37 | dest.writeString(this.shortMessage)
38 | dest.writeStringList(this.longMessages)
39 | dest.writeString(this.systemMessage)
40 | dest.writeInt(this.httpCode)
41 | }
42 |
43 | constructor() {}
44 |
45 | protected constructor(`in`: Parcel) {
46 | val tmpErrorCode = `in`.readInt()
47 | this.errorCode = if (tmpErrorCode == -1) null else TradeItErrorCode.values()[tmpErrorCode]
48 | this.shortMessage = `in`.readString()
49 | this.longMessages = `in`.createStringArrayList()
50 | this.systemMessage = `in`.readString()
51 | this.httpCode = `in`.readInt()
52 | }
53 |
54 | companion object {
55 | @JvmField
56 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
57 | override fun createFromParcel(source: Parcel): TradeItErrorResultParcelable {
58 | return TradeItErrorResultParcelable(source)
59 | }
60 |
61 | override fun newArray(size: Int): Array {
62 | return arrayOfNulls(size)
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItLinkedBrokerAccountData.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | class TradeItLinkedBrokerAccountData(
4 | var accountName: String,
5 | var accountNumber: String,
6 | var accountBaseCurrency: String
7 | )
8 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItLinkedBrokerData.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import java.util.*
4 |
5 | class TradeItLinkedBrokerData {
6 |
7 | var broker: String
8 | var userId: String
9 | var userToken: String
10 | var isLinkActivationPending = false
11 | var linkedBrokerAccounts: MutableList = ArrayList()
12 |
13 | constructor(broker: String, userId: String, userToken: String) {
14 | this.broker = broker
15 | this.userId = userId
16 | this.userToken = userToken
17 | }
18 |
19 | fun withLinkActivationPending(isLinkActivationPending: Boolean): TradeItLinkedBrokerData {
20 | this.isLinkActivationPending = isLinkActivationPending
21 | return this
22 | }
23 |
24 | fun injectAccount(linkedBrokerAccountData: TradeItLinkedBrokerAccountData) {
25 | this.linkedBrokerAccounts.add(linkedBrokerAccountData)
26 | }
27 |
28 | fun injectAccounts(linkedBrokerAccounts: MutableList) {
29 | this.linkedBrokerAccounts = linkedBrokerAccounts
30 | }
31 |
32 | constructor(linkedLoginParcelable: TradeItLinkedLoginParcelable) {
33 | this.broker = linkedLoginParcelable.broker
34 | this.userId = linkedLoginParcelable.userId
35 | this.userToken = linkedLoginParcelable.userToken
36 | }
37 |
38 | override fun equals(other: Any?): Boolean {
39 | if (this === other) return true
40 | if (other == null || javaClass != other.javaClass) return false
41 |
42 | val that = other as TradeItLinkedBrokerData?
43 |
44 | return userId == that!!.userId && userToken == that.userToken
45 | }
46 |
47 | override fun hashCode(): Int {
48 | var result = userId.hashCode()
49 | result = 31 * result + userToken.hashCode()
50 | return result
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItLinkedLoginParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.TradeItOAuthAccessTokenResponse
6 | import it.trade.model.request.TradeItLinkedLogin
7 | import it.trade.model.request.TradeItOAuthAccessTokenRequest
8 |
9 |
10 | class TradeItLinkedLoginParcelable : TradeItLinkedLogin, Parcelable {
11 | constructor(broker: String, userId: String, userToken: String) : super(broker, userId, userToken) {}
12 |
13 | constructor(
14 | oAuthAccessTokenRequest: TradeItOAuthAccessTokenRequest,
15 | oAuthAccessTokenResponse: TradeItOAuthAccessTokenResponse
16 | ) : super(oAuthAccessTokenRequest, oAuthAccessTokenResponse) {}
17 |
18 | constructor(linkedLogin: TradeItLinkedLogin) {
19 | this.broker = linkedLogin.broker
20 | this.userId = linkedLogin.userId
21 | this.userToken = linkedLogin.userToken
22 | this.label = linkedLogin.label
23 | }
24 |
25 | fun getUserId(): String {
26 | return userId
27 | }
28 |
29 | override fun equals(other: Any?): Boolean {
30 | if (this === other) return true
31 | if (other == null || javaClass != other.javaClass) return false
32 |
33 | val that = other as TradeItLinkedLoginParcelable?
34 |
35 | return userId == that!!.userId
36 |
37 | }
38 |
39 | override fun hashCode(): Int {
40 | return userId.hashCode()
41 | }
42 |
43 | override fun describeContents(): Int {
44 | return 0
45 | }
46 |
47 | override fun writeToParcel(dest: Parcel, flags: Int) {
48 | dest.writeString(this.label)
49 | dest.writeString(this.broker)
50 | dest.writeString(this.userToken)
51 | dest.writeString(this.userId)
52 | }
53 |
54 | protected constructor(`in`: Parcel) {
55 | this.label = `in`.readString()
56 | this.broker = `in`.readString()
57 | this.userToken = `in`.readString()
58 | this.userId = `in`.readString()
59 | }
60 |
61 | companion object {
62 | @JvmField
63 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
64 | override fun createFromParcel(source: Parcel): TradeItLinkedLoginParcelable {
65 | return TradeItLinkedLoginParcelable(source)
66 | }
67 |
68 | override fun newArray(size: Int): Array {
69 | return arrayOfNulls(size)
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItOrderActionParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.android.sdk.enums.TradeItOrderAction
7 | import it.trade.android.sdk.enums.TradeItOrderQuantityType
8 |
9 | class TradeItOrderActionParcelable : Parcelable {
10 | var action: TradeItOrderAction
11 | var displayLabel: String
12 | var supportedOrderQuantityTypes: List
13 |
14 | internal constructor(
15 | action: TradeItOrderAction,
16 | displayLabel: String,
17 | supportedOrderQuantityTypes: List
18 | ) {
19 | this.action = action
20 | this.displayLabel = displayLabel
21 | this.supportedOrderQuantityTypes = supportedOrderQuantityTypes
22 | }
23 |
24 | override fun equals(other: Any?): Boolean {
25 | if (this === other) return true
26 | if (javaClass != other?.javaClass) return false
27 |
28 | other as TradeItOrderActionParcelable
29 |
30 | if (action != other.action) return false
31 | if (displayLabel != other.displayLabel) return false
32 | if (supportedOrderQuantityTypes != other.supportedOrderQuantityTypes) return false
33 |
34 | return true
35 | }
36 |
37 | override fun hashCode(): Int {
38 | var result = action.hashCode()
39 | result = 31 * result + displayLabel.hashCode()
40 | result = 31 * result + supportedOrderQuantityTypes.hashCode()
41 | return result
42 | }
43 |
44 | override fun describeContents(): Int {
45 | return 0
46 | }
47 |
48 | override fun writeToParcel(dest: Parcel, flags: Int) {
49 | dest.writeInt(this.action.ordinal)
50 | dest.writeString(this.displayLabel)
51 | dest.writeList(this.supportedOrderQuantityTypes)
52 | }
53 |
54 | protected constructor(`in`: Parcel) {
55 | val tmpAction = `in`.readInt()
56 | this.action = TradeItOrderAction.values()[tmpAction]
57 | this.displayLabel = `in`.readString()
58 | this.supportedOrderQuantityTypes = ArrayList()
59 | `in`.readList(this.supportedOrderQuantityTypes, TradeItOrderQuantityType::class.java.getClassLoader())
60 | }
61 |
62 | companion object {
63 | @JvmField
64 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
65 | override fun createFromParcel(source: Parcel): TradeItOrderActionParcelable {
66 | return TradeItOrderActionParcelable(source)
67 | }
68 |
69 | override fun newArray(size: Int): Array {
70 | return arrayOfNulls(size)
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItOrderExpirationTypeParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.android.sdk.enums.TradeItOrderExpirationType
7 |
8 | class TradeItOrderExpirationTypeParcelable : Parcelable {
9 | var expirationType: TradeItOrderExpirationType
10 | private set
11 | var displayLabel: String
12 |
13 | internal constructor(expiration: TradeItOrderExpirationType, displayLabel: String) {
14 | this.expirationType = expiration
15 | this.displayLabel = displayLabel
16 | }
17 |
18 | fun setExpiration(expiration: TradeItOrderExpirationType) {
19 | this.expirationType = expiration
20 | }
21 |
22 | override fun equals(other: Any?): Boolean {
23 | if (this === other) return true
24 | if (javaClass != other?.javaClass) return false
25 |
26 | other as TradeItOrderExpirationTypeParcelable
27 |
28 | if (expirationType != other.expirationType) return false
29 | if (displayLabel != other.displayLabel) return false
30 |
31 | return true
32 | }
33 |
34 | override fun hashCode(): Int {
35 | var result = expirationType.hashCode()
36 | result = 31 * result + displayLabel.hashCode()
37 | return result
38 | }
39 |
40 | override fun describeContents(): Int {
41 | return 0
42 | }
43 |
44 | override fun writeToParcel(dest: Parcel, flags: Int) {
45 | dest.writeInt(this.expirationType.ordinal)
46 | dest.writeString(this.displayLabel)
47 | }
48 |
49 | protected constructor(`in`: Parcel) {
50 | val tmpExpiration = `in`.readInt()
51 | this.expirationType = TradeItOrderExpirationType.values()[tmpExpiration]
52 | this.displayLabel = `in`.readString()
53 | }
54 |
55 | companion object {
56 | @JvmField
57 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
58 | override fun createFromParcel(source: Parcel): TradeItOrderExpirationTypeParcelable {
59 | return TradeItOrderExpirationTypeParcelable(source)
60 | }
61 |
62 | override fun newArray(size: Int): Array {
63 | return arrayOfNulls(size)
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItOrderInfoParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.reponse.OrderInfo
7 | import it.trade.model.reponse.Price
8 |
9 | class TradeItOrderInfoParcelable : Parcelable {
10 | var action: String? = ""
11 | internal set
12 | var quantity: Double? = null
13 | internal set
14 | var symbol: String = ""
15 | internal set
16 | var price: TradeItPriceParcelable? = null
17 | internal set
18 | var expiration: String? = ""
19 | internal set
20 | var orderQuantityType: String? = ""
21 |
22 | internal constructor(orderInfo: OrderInfo) {
23 | this.action = orderInfo.action
24 | this.quantity = orderInfo.quantity
25 | this.symbol = orderInfo.symbol
26 | this.price = TradeItPriceParcelable(orderInfo.price)
27 | this.expiration = orderInfo.expiration
28 | this.orderQuantityType = orderInfo.orderQuantityType
29 | }
30 |
31 | internal constructor() {}
32 |
33 | override fun toString(): String {
34 | return "TradeItOrderInfoParcelable{" +
35 | "action='" + action + '\''.toString() +
36 | ", quantity=" + quantity +
37 | ", symbol='" + symbol + '\''.toString() +
38 | ", price=" + price +
39 | ", expiration='" + expiration + '\''.toString() +
40 | ", orderQuantityType='" + orderQuantityType + '\''.toString() +
41 | '}'.toString()
42 | }
43 |
44 | override fun describeContents(): Int {
45 | return 0
46 | }
47 |
48 | override fun writeToParcel(dest: Parcel, flags: Int) {
49 | dest.writeString(this.action)
50 | dest.writeValue(this.quantity)
51 | dest.writeString(this.symbol)
52 | dest.writeParcelable(this.price, flags)
53 | dest.writeString(this.expiration)
54 | dest.writeString(this.orderQuantityType)
55 | }
56 |
57 | protected constructor(`in`: Parcel) {
58 | this.action = `in`.readString()
59 | this.quantity = `in`.readValue(Double::class.java.getClassLoader()) as? Double
60 | this.symbol = `in`.readString()
61 | this.price = `in`.readParcelable(Price::class.java.getClassLoader())
62 | this.expiration = `in`.readString()
63 | this.orderQuantityType = `in`.readString()
64 | }
65 |
66 | companion object {
67 | @JvmField
68 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
69 | override fun createFromParcel(source: Parcel): TradeItOrderInfoParcelable {
70 | return TradeItOrderInfoParcelable(source)
71 | }
72 |
73 | override fun newArray(size: Int): Array {
74 | return arrayOfNulls(size)
75 | }
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItOrderPriceTypeParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.android.sdk.enums.TradeItOrderPriceType
7 | import it.trade.android.sdk.enums.TradeItOrderQuantityType
8 |
9 | class TradeItOrderPriceTypeParcelable : Parcelable {
10 | var priceType: TradeItOrderPriceType
11 | var displayLabel: String
12 | var supportedOrderQuantityTypes: List = arrayListOf()
13 |
14 | internal constructor(
15 | priceType: TradeItOrderPriceType,
16 | displayLabel: String,
17 | supportedOrderQuantityTypes: List
18 | ) {
19 | this.priceType = priceType
20 | this.displayLabel = displayLabel
21 | this.supportedOrderQuantityTypes = supportedOrderQuantityTypes
22 | }
23 |
24 | override fun equals(other: Any?): Boolean {
25 | if (this === other) return true
26 | if (javaClass != other?.javaClass) return false
27 |
28 | other as TradeItOrderPriceTypeParcelable
29 |
30 | if (priceType != other.priceType) return false
31 | if (displayLabel != other.displayLabel) return false
32 | if (supportedOrderQuantityTypes != other.supportedOrderQuantityTypes) return false
33 |
34 | return true
35 | }
36 |
37 | override fun hashCode(): Int {
38 | var result = priceType.hashCode()
39 | result = 31 * result + displayLabel.hashCode()
40 | result = 31 * result + supportedOrderQuantityTypes.hashCode()
41 | return result
42 | }
43 |
44 | override fun describeContents(): Int {
45 | return 0
46 | }
47 |
48 | override fun writeToParcel(dest: Parcel, flags: Int) {
49 | dest.writeInt(this.priceType.ordinal)
50 | dest.writeString(this.displayLabel)
51 | dest.writeList(this.supportedOrderQuantityTypes)
52 | }
53 |
54 | protected constructor(`in`: Parcel) {
55 | val tmpPriceType = `in`.readInt()
56 | this.priceType = TradeItOrderPriceType.values()[tmpPriceType]
57 | this.displayLabel = `in`.readString()
58 | this.supportedOrderQuantityTypes = ArrayList()
59 | `in`.readList(this.supportedOrderQuantityTypes, TradeItOrderQuantityType::class.java.getClassLoader())
60 | }
61 |
62 | companion object {
63 | @JvmField
64 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
65 | override fun createFromParcel(source: Parcel): TradeItOrderPriceTypeParcelable {
66 | return TradeItOrderPriceTypeParcelable(source)
67 | }
68 |
69 | override fun newArray(size: Int): Array {
70 | return arrayOfNulls(size)
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPlaceCryptoOrderResponseParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.TradeItPlaceCryptoOrderResponse
6 |
7 | class TradeItPlaceCryptoOrderResponseParcelable: Parcelable {
8 | var orderNumber: String = ""
9 | var confirmationMessage: String = ""
10 | var broker: String = ""
11 | var accountBaseCurrency: String = ""
12 | var timestamp: String = ""
13 | var orderDetails: TradeItCryptoTradeOrderDetailsParcelable? = null
14 |
15 | internal constructor() {}
16 |
17 | internal constructor (response: TradeItPlaceCryptoOrderResponse) {
18 | this.orderNumber = response.orderNumber
19 | this.confirmationMessage = response.confirmationMessage
20 | this.broker = response.broker
21 | this.accountBaseCurrency = response.accountBaseCurrency
22 | this.timestamp = response.timestamp
23 | this.orderDetails = TradeItCryptoTradeOrderDetailsParcelable(response.orderDetails)
24 | }
25 |
26 | constructor(parcel: Parcel) {
27 | orderNumber = parcel.readString()
28 | confirmationMessage = parcel.readString()
29 | broker = parcel.readString()
30 | accountBaseCurrency = parcel.readString()
31 | timestamp = parcel.readString()
32 | orderDetails = parcel.readParcelable(TradeItCryptoTradeOrderDetailsParcelable::class.java.classLoader)
33 | }
34 |
35 | override fun toString(): String {
36 | return "TradeItPlaceCryptoOrderResponseParcelable(" +
37 | "orderNumber=$orderNumber, " +
38 | "confirmationMessage=$confirmationMessage, " +
39 | "broker=$broker, " +
40 | "accountBaseCurrency=$accountBaseCurrency, " +
41 | "timestamp=$timestamp, " +
42 | "orderDetails=$orderDetails" +
43 | ")"
44 | }
45 |
46 | override fun writeToParcel(parcel: Parcel, flags: Int) {
47 | parcel.writeString(orderNumber)
48 | parcel.writeString(confirmationMessage)
49 | parcel.writeString(broker)
50 | parcel.writeString(accountBaseCurrency)
51 | parcel.writeString(timestamp)
52 | parcel.writeParcelable(orderDetails, flags)
53 | }
54 |
55 | override fun describeContents(): Int {
56 | return 0
57 | }
58 |
59 | companion object {
60 | @JvmField
61 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
62 | override fun createFromParcel(source: Parcel): TradeItPlaceCryptoOrderResponseParcelable = TradeItPlaceCryptoOrderResponseParcelable(source)
63 | override fun newArray(size: Int): Array = arrayOfNulls(size)
64 | }
65 | }
66 |
67 |
68 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPlaceStockOrEtfOrderResponseParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.reponse.TradeItPlaceStockOrEtfOrderResponse
7 |
8 | class TradeItPlaceStockOrEtfOrderResponseParcelable : Parcelable {
9 |
10 | var broker: String? = ""
11 | internal set
12 | var confirmationMessage: String? = ""
13 | internal set
14 | var orderNumber: String = ""
15 | internal set
16 | var timestamp: String? = ""
17 | internal set
18 | var orderInfo: TradeItOrderInfoParcelable? = null
19 | internal set
20 |
21 | internal constructor(response: TradeItPlaceStockOrEtfOrderResponse) {
22 | this.broker = response.broker
23 | this.confirmationMessage = response.confirmationMessage
24 | this.orderNumber = response.orderNumber
25 | this.timestamp = response.timestamp
26 | this.orderInfo = TradeItOrderInfoParcelable(response.orderInfo)
27 | }
28 |
29 | internal constructor() {}
30 |
31 | override fun toString(): String {
32 | return "TradeItPlaceStockOrEtfOrderResponseParcelable{" +
33 | "broker='" + broker + '\''.toString() +
34 | ", confirmationMessage='" + confirmationMessage + '\''.toString() +
35 | ", orderNumber='" + orderNumber + '\''.toString() +
36 | ", timestamp='" + timestamp + '\''.toString() +
37 | ", orderInfo=" + orderInfo +
38 | '}'.toString()
39 | }
40 |
41 | override fun describeContents(): Int {
42 | return 0
43 | }
44 |
45 | override fun writeToParcel(dest: Parcel, flags: Int) {
46 | dest.writeString(this.broker)
47 | dest.writeString(this.confirmationMessage)
48 | dest.writeString(this.orderNumber)
49 | dest.writeString(this.timestamp)
50 | dest.writeParcelable(this.orderInfo, flags)
51 | }
52 |
53 | protected constructor(`in`: Parcel) {
54 | this.broker = `in`.readString()
55 | this.confirmationMessage = `in`.readString()
56 | this.orderNumber = `in`.readString()
57 | this.timestamp = `in`.readString()
58 | this.orderInfo = `in`.readParcelable(TradeItOrderInfoParcelable::class.java.getClassLoader())
59 | }
60 |
61 | companion object {
62 | @JvmField
63 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
64 | override fun createFromParcel(source: Parcel): TradeItPlaceStockOrEtfOrderResponseParcelable {
65 | return TradeItPlaceStockOrEtfOrderResponseParcelable(source)
66 | }
67 |
68 | override fun newArray(size: Int): Array {
69 | return arrayOfNulls(size)
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPositionParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.reponse.TradeItPosition
7 |
8 | class TradeItPositionParcelable : TradeItPosition, Parcelable {
9 |
10 | constructor(position: TradeItPosition) {
11 | this.costbasis = position.costbasis
12 | this.holdingType = position.holdingType
13 | this.lastPrice = position.lastPrice
14 | this.quantity = position.quantity
15 | this.symbol = position.symbol
16 | this.symbolClass = position.symbolClass
17 | this.todayGainLossDollar = position.todayGainLossDollar
18 | this.todayGainLossPercentage = position.totalGainLossPercentage
19 | this.totalGainLossDollar = position.totalGainLossDollar
20 | this.totalGainLossPercentage = position.totalGainLossPercentage
21 | this.todayGainLossAbsolute = position.todayGainLossAbsolute
22 | this.totalGainLossAbsolute = position.totalGainLossAbsolute
23 | this.exchange = position.exchange
24 | this.currency = position.currency
25 | }
26 |
27 | constructor() : super() {}
28 |
29 | override fun describeContents(): Int {
30 | return 0
31 | }
32 |
33 | override fun writeToParcel(dest: Parcel, flags: Int) {
34 | dest.writeValue(this.costbasis)
35 | dest.writeString(this.holdingType)
36 | dest.writeValue(this.lastPrice)
37 | dest.writeValue(this.quantity)
38 | dest.writeString(this.symbol)
39 | dest.writeString(this.symbolClass)
40 | dest.writeValue(this.todayGainLossDollar)
41 | dest.writeValue(this.todayGainLossPercentage)
42 | dest.writeValue(this.totalGainLossDollar)
43 | dest.writeValue(this.totalGainLossPercentage)
44 | dest.writeValue(this.todayGainLossAbsolute)
45 | dest.writeValue(this.totalGainLossAbsolute)
46 | dest.writeString(this.exchange)
47 | dest.writeString(this.currency)
48 | }
49 |
50 | protected constructor(`in`: Parcel) {
51 | this.costbasis = `in`.readValue(Double::class.java.getClassLoader()) as? Double
52 | this.holdingType = `in`.readString()
53 | this.lastPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
54 | this.quantity = `in`.readValue(Double::class.java.getClassLoader()) as? Double
55 | this.symbol = `in`.readString()
56 | this.symbolClass = `in`.readString()
57 | this.todayGainLossDollar = `in`.readValue(Double::class.java.getClassLoader()) as? Double
58 | this.todayGainLossPercentage = `in`.readValue(Double::class.java.getClassLoader()) as? Double
59 | this.totalGainLossDollar = `in`.readValue(Double::class.java.getClassLoader()) as? Double
60 | this.totalGainLossPercentage = `in`.readValue(Double::class.java.getClassLoader()) as? Double
61 | this.todayGainLossAbsolute = `in`.readValue(Double::class.java.getClassLoader()) as? Double
62 | this.totalGainLossAbsolute = `in`.readValue(Double::class.java.getClassLoader()) as? Double
63 | this.exchange = `in`.readString()
64 | this.currency = `in`.readString()
65 | }
66 |
67 | companion object {
68 | @JvmField
69 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
70 | override fun createFromParcel(source: Parcel): TradeItPositionParcelable {
71 | return TradeItPositionParcelable(source)
72 | }
73 |
74 | override fun newArray(size: Int): Array {
75 | return arrayOfNulls(size)
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPreviewCryptoOrderResponseParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.TradeItPreviewCryptoOrderResponse
6 |
7 | class TradeItPreviewCryptoOrderResponseParcelable: Parcelable {
8 | var orderId: String = ""
9 |
10 | var orderDetails: TradeItCryptoPreviewOrderDetailsParcelable? = null
11 |
12 | internal constructor() {}
13 |
14 | internal constructor (response: TradeItPreviewCryptoOrderResponse) {
15 | this.orderId = response.orderId
16 | this.orderDetails = TradeItCryptoPreviewOrderDetailsParcelable(response.orderDetails)
17 | }
18 |
19 | override fun toString(): String {
20 | return "TradeItPreviewCryptoOrderResponseParcelable(orderId='$orderId', orderDetails=$orderDetails)"
21 | }
22 |
23 | constructor(parcel: Parcel) {
24 | orderId = parcel.readString()
25 | orderDetails = parcel.readParcelable(TradeItCryptoPreviewOrderDetailsParcelable::class.java.classLoader)
26 | }
27 |
28 | override fun writeToParcel(parcel: Parcel, flags: Int) {
29 | parcel.writeString(orderId)
30 | parcel.writeParcelable(orderDetails, flags)
31 | }
32 |
33 | override fun describeContents(): Int {
34 | return 0
35 | }
36 |
37 | companion object {
38 | @JvmField
39 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
40 | override fun createFromParcel(source: Parcel): TradeItPreviewCryptoOrderResponseParcelable = TradeItPreviewCryptoOrderResponseParcelable(source)
41 | override fun newArray(size: Int): Array = arrayOfNulls(size)
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPreviewStockOrEtfOrderResponseParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.OrderDetails
6 | import it.trade.model.reponse.TradeItPreviewStockOrEtfOrderResponse
7 |
8 | class TradeItPreviewStockOrEtfOrderResponseParcelable : Parcelable {
9 |
10 | var orderId: String = ""
11 |
12 | @get:Deprecated("Use orderDetails.warnings")
13 | var ackWarningsList: List? = arrayListOf()
14 |
15 | @get:Deprecated("Use orderDetails.warnings")
16 | var warningsList: List? = arrayListOf()
17 | var orderDetails: TradeItOrderDetailsParcelable? = null
18 |
19 | internal constructor(response: TradeItPreviewStockOrEtfOrderResponse) {
20 | this.orderId = response.orderId
21 | this.ackWarningsList = response.ackWarningsList
22 | this.warningsList = response.warningsList
23 | this.orderDetails = TradeItOrderDetailsParcelable(response.orderDetails)
24 | }
25 |
26 | override fun toString(): String {
27 | return "TradeItPreviewStockOrEtfOrderResponseParcelable{" +
28 | "orderId='" + orderId + '\''.toString() +
29 | ", orderDetails=" + orderDetails +
30 | '}'.toString()
31 | }
32 |
33 | override fun describeContents(): Int {
34 | return 0
35 | }
36 |
37 | override fun writeToParcel(dest: Parcel, flags: Int) {
38 | dest.writeStringList(this.ackWarningsList)
39 | dest.writeParcelable(this.orderDetails, flags)
40 | dest.writeString(this.orderId)
41 | dest.writeStringList(this.warningsList)
42 | }
43 |
44 | constructor() {}
45 |
46 | protected constructor(`in`: Parcel) {
47 | this.ackWarningsList = `in`.createStringArrayList()
48 | this.orderDetails = `in`.readParcelable(OrderDetails::class.java.getClassLoader())
49 | this.orderId = `in`.readString()
50 | this.warningsList = `in`.createStringArrayList()
51 | }
52 |
53 | companion object {
54 | @JvmField
55 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
56 | override fun createFromParcel(source: Parcel): TradeItPreviewStockOrEtfOrderResponseParcelable {
57 | return TradeItPreviewStockOrEtfOrderResponseParcelable(source)
58 | }
59 |
60 | override fun newArray(size: Int): Array {
61 | return arrayOfNulls(size)
62 | }
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItPriceParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.reponse.Price
7 |
8 | class TradeItPriceParcelable : Parcelable {
9 |
10 | var type: String? = ""
11 | internal set
12 | var limitPrice: Double? = null
13 | internal set
14 | var stopPrice: Double? = null
15 | internal set
16 | var last: Double? = null
17 | internal set
18 | var bid: Double? = null
19 | internal set
20 | var ask: Double? = null
21 | internal set
22 | var timestamp: String? = ""
23 | internal set
24 |
25 | internal constructor(price: Price) {
26 | this.type = price.type
27 | this.limitPrice = price.limitPrice
28 | this.stopPrice = price.stopPrice
29 | this.last = price.last
30 | this.bid = price.bid
31 | this.ask = price.ask
32 | this.timestamp = price.timestamp
33 | }
34 |
35 | internal constructor() {}
36 |
37 | override fun toString(): String {
38 | return "TradeItPriceParcelable{" +
39 | "type='" + type + '\''.toString() +
40 | ", limitPrice=" + limitPrice +
41 | ", stopPrice=" + stopPrice +
42 | ", last=" + last +
43 | ", bid=" + bid +
44 | ", ask=" + ask +
45 | ", timestamp='" + timestamp + '\''.toString() +
46 | '}'.toString()
47 | }
48 |
49 | override fun describeContents(): Int {
50 | return 0
51 | }
52 |
53 | override fun writeToParcel(dest: Parcel, flags: Int) {
54 | dest.writeString(this.type)
55 | dest.writeValue(this.limitPrice)
56 | dest.writeValue(this.stopPrice)
57 | dest.writeValue(this.last)
58 | dest.writeValue(this.bid)
59 | dest.writeValue(this.ask)
60 | dest.writeString(this.timestamp)
61 | }
62 |
63 | protected constructor(`in`: Parcel) {
64 | this.type = `in`.readString()
65 | this.limitPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
66 | this.stopPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
67 | this.last = `in`.readValue(Double::class.java.getClassLoader()) as? Double
68 | this.bid = `in`.readValue(Double::class.java.getClassLoader()) as? Double
69 | this.ask = `in`.readValue(Double::class.java.getClassLoader()) as? Double
70 | this.timestamp = `in`.readString()
71 | }
72 |
73 | companion object {
74 | @JvmField
75 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
76 | override fun createFromParcel(source: Parcel): TradeItPriceParcelable {
77 | return TradeItPriceParcelable(source)
78 | }
79 |
80 | override fun newArray(size: Int): Array {
81 | return arrayOfNulls(size)
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItSecurityQuestionParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.TradeItSecurityQuestion
7 |
8 | class TradeItSecurityQuestionParcelable : TradeItSecurityQuestion, Parcelable {
9 |
10 | constructor(securityQuestion: String, securityQuestionOptions: List) : super(securityQuestion, securityQuestionOptions) {}
11 |
12 |
13 | override fun describeContents(): Int {
14 | return 0
15 | }
16 |
17 | override fun writeToParcel(dest: Parcel, flags: Int) {
18 | dest.writeString(this.securityQuestion)
19 | dest.writeStringList(this.securityQuestionOptions)
20 | }
21 |
22 | protected constructor(`in`: Parcel) {
23 | this.securityQuestion = `in`.readString()
24 | this.securityQuestionOptions = `in`.createStringArrayList()
25 | }
26 |
27 | companion object {
28 | @JvmField
29 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
30 | override fun createFromParcel(source: Parcel): TradeItSecurityQuestionParcelable {
31 | return TradeItSecurityQuestionParcelable(source)
32 | }
33 |
34 | override fun newArray(size: Int): Array {
35 | return arrayOfNulls(size)
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItWarningLinkParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import it.trade.model.reponse.WarningLink
7 |
8 | class TradeItWarningLinkParcelable : Parcelable {
9 | var label: String
10 | protected set
11 | var url: String
12 | protected set
13 |
14 | internal constructor(link: WarningLink) {
15 | this.label = link.label
16 | this.url = link.url
17 | }
18 |
19 | override fun equals(other: Any?): Boolean {
20 | if (this === other) return true
21 | if (javaClass != other?.javaClass) return false
22 |
23 | other as TradeItWarningLinkParcelable
24 |
25 | if (label != other.label) return false
26 | if (url != other.url) return false
27 |
28 | return true
29 | }
30 |
31 | override fun hashCode(): Int {
32 | var result = label.hashCode()
33 | result = 31 * result + url.hashCode()
34 | return result
35 | }
36 |
37 | override fun describeContents(): Int {
38 | return 0
39 | }
40 |
41 | override fun writeToParcel(dest: Parcel, flags: Int) {
42 | dest.writeString(this.label)
43 | dest.writeString(this.url)
44 | }
45 |
46 | protected constructor(`in`: Parcel) {
47 | this.label = `in`.readString()
48 | this.url = `in`.readString()
49 | }
50 |
51 | companion object {
52 | @JvmField
53 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
54 | override fun createFromParcel(source: Parcel): TradeItWarningLinkParcelable {
55 | return TradeItWarningLinkParcelable(source)
56 | }
57 |
58 | override fun newArray(size: Int): Array {
59 | return arrayOfNulls(size)
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/TradeItWarningParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 | import it.trade.model.reponse.Warning
6 | import it.trade.model.reponse.WarningLink
7 | import java.util.*
8 |
9 | class TradeItWarningParcelable : Parcelable {
10 | var message: String? = null
11 | protected set
12 | var isRequiresAcknowledgement: Boolean = false
13 | protected set
14 | var links: List? = null
15 | protected set
16 |
17 | internal constructor(warning: Warning) {
18 | this.message = warning.message
19 | this.isRequiresAcknowledgement = warning.requiresAcknowledgement
20 | this.links = mapLinks(warning.links)
21 | }
22 |
23 | override fun equals(other: Any?): Boolean {
24 | if (this === other) return true
25 | if (other == null || javaClass != other.javaClass) return false
26 |
27 | val that = other as TradeItWarningParcelable?
28 |
29 | if (isRequiresAcknowledgement != that!!.isRequiresAcknowledgement) return false
30 | if (if (message != null) message != that.message else that.message != null) return false
31 | return if (links != null) links == that.links else that.links == null
32 | }
33 |
34 | override fun hashCode(): Int {
35 | var result = if (message != null) message!!.hashCode() else 0
36 | result = 31 * result + if (isRequiresAcknowledgement) 1 else 0
37 | result = 31 * result + if (links != null) links!!.hashCode() else 0
38 | return result
39 | }
40 |
41 | override fun describeContents(): Int {
42 | return 0
43 | }
44 |
45 | override fun writeToParcel(dest: Parcel, flags: Int) {
46 | dest.writeString(this.message)
47 | dest.writeByte(if (this.isRequiresAcknowledgement) 1.toByte() else 0.toByte())
48 | dest.writeList(this.links)
49 | }
50 |
51 | protected constructor(`in`: Parcel) {
52 | this.message = `in`.readString()
53 | this.isRequiresAcknowledgement = `in`.readByte().toInt() != 0
54 | this.links = ArrayList()
55 | `in`.readList(this.links, TradeItWarningLinkParcelable::class.java.getClassLoader())
56 | }
57 |
58 | companion object {
59 |
60 | private fun mapLinks(links: List?): List {
61 | val mappedValues = ArrayList()
62 | if (links != null) {
63 | for (link in links) {
64 | mappedValues.add(TradeItWarningLinkParcelable(link))
65 | }
66 | }
67 | return mappedValues
68 | }
69 | @JvmField
70 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
71 | override fun createFromParcel(source: Parcel): TradeItWarningParcelable {
72 | return TradeItWarningParcelable(source)
73 | }
74 |
75 | override fun newArray(size: Int): Array {
76 | return arrayOfNulls(size)
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/orderstatus/TradeItFillParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model.orderstatus
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import com.google.gson.annotations.SerializedName
7 |
8 | import it.trade.model.reponse.Fill
9 |
10 | class TradeItFillParcelable : Parcelable {
11 |
12 | @SerializedName("timestampFormat")
13 | var timestampFormat: String? = null
14 | private set
15 |
16 | @SerializedName("price")
17 | var price: Double? = null
18 | private set
19 |
20 | @SerializedName("timestamp")
21 | var timestamp: String? = null
22 | private set
23 |
24 | @SerializedName("quantity")
25 | var quantity: Double? = null
26 | private set
27 |
28 | internal constructor(fill: Fill) {
29 | this.timestampFormat = fill.timestampFormat
30 | this.price = fill.price
31 | this.timestamp = fill.timestamp
32 | this.quantity = fill.quantity
33 | }
34 |
35 | override fun toString(): String {
36 | return "TradeItFillParcelable{" +
37 | "timestampFormat='" + timestampFormat + '\''.toString() +
38 | ", price=" + price +
39 | ", timestamp='" + timestamp + '\''.toString() +
40 | ", quantity=" + quantity +
41 | '}'.toString()
42 | }
43 |
44 | override fun equals(other: Any?): Boolean {
45 | if (this === other) return true
46 | if (other == null || javaClass != other.javaClass) return false
47 |
48 | val that = other as TradeItFillParcelable?
49 |
50 | if (if (timestampFormat != null) timestampFormat != that!!.timestampFormat else that!!.timestampFormat != null)
51 | return false
52 | if (if (price != null) price != that.price else that.price != null) return false
53 | if (if (timestamp != null) timestamp != that.timestamp else that.timestamp != null)
54 | return false
55 | return if (quantity != null) quantity == that.quantity else that.quantity == null
56 |
57 | }
58 |
59 | override fun hashCode(): Int {
60 | var result = if (timestampFormat != null) timestampFormat!!.hashCode() else 0
61 | result = 31 * result + if (price != null) price!!.hashCode() else 0
62 | result = 31 * result + if (timestamp != null) timestamp!!.hashCode() else 0
63 | result = 31 * result + if (quantity != null) quantity!!.hashCode() else 0
64 | return result
65 | }
66 |
67 | override fun describeContents(): Int {
68 | return 0
69 | }
70 |
71 | override fun writeToParcel(dest: Parcel, flags: Int) {
72 | dest.writeString(this.timestampFormat)
73 | dest.writeValue(this.price)
74 | dest.writeString(this.timestamp)
75 | dest.writeValue(this.quantity)
76 | }
77 |
78 | protected constructor(`in`: Parcel) {
79 | this.timestampFormat = `in`.readString()
80 | this.price = `in`.readValue(Double::class.java.getClassLoader()) as? Double
81 | this.timestamp = `in`.readString()
82 | this.quantity = `in`.readValue(Double::class.java.getClassLoader()) as? Double
83 | }
84 |
85 | companion object {
86 | @JvmField
87 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
88 | override fun createFromParcel(source: Parcel): TradeItFillParcelable {
89 | return TradeItFillParcelable(source)
90 | }
91 |
92 | override fun newArray(size: Int): Array {
93 | return arrayOfNulls(size)
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/kotlin/it/trade/android/sdk/model/orderstatus/TradeItPriceInfoParcelable.kt:
--------------------------------------------------------------------------------
1 | package it.trade.android.sdk.model.orderstatus
2 |
3 | import android.os.Parcel
4 | import android.os.Parcelable
5 |
6 | import com.google.gson.annotations.SerializedName
7 |
8 | import it.trade.model.reponse.PriceInfo
9 |
10 | class TradeItPriceInfoParcelable : Parcelable {
11 |
12 | @SerializedName("trailPrice")
13 | var trailPrice: Double? = null
14 | private set
15 |
16 | @SerializedName("limitPrice")
17 | var limitPrice: Double? = null
18 | private set
19 |
20 | @SerializedName("type")
21 | var type: String? = null
22 | private set
23 |
24 | @SerializedName("stopPrice")
25 | var stopPrice: Double? = null
26 | private set
27 |
28 | internal constructor(priceInfo: PriceInfo) {
29 | this.trailPrice = priceInfo.trailPrice
30 | this.limitPrice = priceInfo.limitPrice
31 | this.type = priceInfo.type
32 | this.stopPrice = priceInfo.stopPrice
33 | }
34 |
35 | override fun toString(): String {
36 | return "TradeItPriceInfoParcelable{" +
37 | ", trailPrice=" + trailPrice +
38 | ", limitPrice=" + limitPrice +
39 | ", type='" + type + '\''.toString() +
40 | ", stopPrice=" + stopPrice +
41 | '}'.toString()
42 | }
43 |
44 | override fun equals(other: Any?): Boolean {
45 | if (this === other) return true
46 | if (other == null || javaClass != other.javaClass) return false
47 |
48 | val that = other as TradeItPriceInfoParcelable?
49 |
50 | if (if (trailPrice != null) trailPrice != that?.trailPrice else that?.trailPrice != null)
51 | return false
52 | if (if (limitPrice != null) limitPrice != that?.limitPrice else that?.limitPrice != null)
53 | return false
54 | if (if (type != null) type != that?.type else that?.type != null) return false
55 | return if (stopPrice != null) stopPrice == that?.stopPrice else that?.stopPrice == null
56 |
57 | }
58 |
59 | override fun hashCode(): Int {
60 | var result = if (trailPrice != null) trailPrice!!.hashCode() else 0
61 | result = 31 * result + if (limitPrice != null) limitPrice!!.hashCode() else 0
62 | result = 31 * result + if (type != null) type!!.hashCode() else 0
63 | result = 31 * result + if (stopPrice != null) stopPrice!!.hashCode() else 0
64 | return result
65 | }
66 |
67 | override fun describeContents(): Int {
68 | return 0
69 | }
70 |
71 | override fun writeToParcel(dest: Parcel, flags: Int) {
72 | dest.writeValue(this.trailPrice)
73 | dest.writeValue(this.limitPrice)
74 | dest.writeString(this.type)
75 | dest.writeValue(this.stopPrice)
76 | }
77 |
78 | protected constructor(`in`: Parcel) {
79 | this.trailPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
80 | this.limitPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
81 | this.type = `in`.readString()
82 | this.stopPrice = `in`.readValue(Double::class.java.getClassLoader()) as? Double
83 | }
84 |
85 | companion object {
86 | @JvmField
87 | val CREATOR: Parcelable.Creator = object : Parcelable.Creator {
88 | override fun createFromParcel(source: Parcel): TradeItPriceInfoParcelable {
89 | return TradeItPriceInfoParcelable(source)
90 | }
91 |
92 | override fun newArray(size: Int): Array {
93 | return arrayOfNulls(size)
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TradeItAndroidSdk
3 |
4 |
--------------------------------------------------------------------------------
/tradeit-android-sdk/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
--------------------------------------------------------------------------------