This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Poloniex Integration #60
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
35e29d9
Pulled changes from both xcode9 branch and poloniex branch to make th…
wolffan 70917cf
Pulled changes from both xcode9 branch and poloniex branch to make th…
wolffan 38d7e16
Added a tentative generic protocol for api implementation
wolffan 370c9eb
Refactor the Poloniex API to have a more sane way of creating request…
wolffan a0a7284
[Data layer]
wolffan 8fb6944
Update Sync for Poloniex, adding needed checks.
wolffan 27198d1
Fix the account sync for Poloniex and other accounts with no accessToken
wolffan c014893
Tests
wolffan 67a5627
Test Target
wolffan 69fa13b
Added both fils
wolffan 6ec77df
Fixing tests
wolffan 20b6791
Cleaning thetest target for merge with gdax
wolffan 4b6df36
Some renaming and refactoring
einsteinx2 4280d7b
Fix bad rebase, creating again the testing target and adding .json fi…
wolffan 44aa83f
Adding tests for institution (not working) and other poloniex elements
wolffan 87debf8
Refactor currency calculators to be able to test them
wolffan 168cadb
Refactor
wolffan 4a96afd
Small cleanup to Currency enum
einsteinx2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// PoloniexAccount.swift | ||
// BalanceOpen | ||
// | ||
// Created by Raimon Lapuente on 28/07/2017. | ||
// Copyright © 2017 Balanced Software, Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct PoloniexAccount { | ||
let type: AccountType | ||
|
||
let currency: String | ||
let available: Decimal | ||
let onOrders: Decimal | ||
let btcValue: Decimal | ||
|
||
init(dictionary:[String:AnyObject],currency:String, type: AccountType) throws { | ||
self.type = type | ||
self.currency = currency | ||
let availableAmount: String = try checkType(dictionary, name: "available") | ||
let availableDecimal = NumberUtils.decimalFormatter.number(from: availableAmount)?.decimalValue | ||
self.available = try checkType(availableDecimal, name: "availableDecimal") | ||
|
||
let onOrdersAmount: String = try checkType(dictionary, name: "onOrders") | ||
let onOrdersdecimal = NumberUtils.decimalFormatter.number(from: onOrdersAmount)?.decimalValue | ||
self.onOrders = try checkType(onOrdersdecimal, name: "onOrdersdecimal") | ||
|
||
let btcValueAmount: String = try checkType(dictionary, name: "btcValue") | ||
let btcValueDecimal = NumberUtils.decimalFormatter.number(from: btcValueAmount)?.decimalValue | ||
self.btcValue = try checkType(btcValueDecimal, name: "btcValueDecimal") | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the chance in syntax here? Swift 4 thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created my own method for raw value.
Since we have two enums, one is nested and the other is an attributed type.
Just tried to be similar than what we had before :)