-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #6
base: master
Are you sure you want to change the base?
Develop #6
Conversation
@TerrickMansur Could you pull the latest changes and resolve conflicts, please? |
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.
Hey @TerrickMansur Really appreciate your efforts in adding feature to this fairly new repo. If it is not too much to ask, could you also add getOpenOrders method in other exchanges, where available, please?
@@ -7,6 +7,30 @@ | |||
|
|||
import Foundation | |||
|
|||
public enum OrderType: String { | |||
case Buy = "Buy" |
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.
String enum values are implicit. No need to specify explicitly unless the value is different from enum case name.
@@ -102,6 +102,27 @@ public struct Cryptopia { | |||
} | |||
} | |||
|
|||
public class CryptopiaOrder: Order { |
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.
Rename CryptopiaOrder to just Order. Reason: It is already inside the struct, Cryptopia.
Also, Subclass Order from Cryptex.Order to avoid name collision after renaming.
self.remaining = NSDecimalNumber(json["Remaining"]) | ||
self.total = NSDecimalNumber(json["Total"]) | ||
if let market = json["Market"] as? String { | ||
let split = market.components(separatedBy: "/") |
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.
Use convenience init method from CurrencyPair extension in Cryptopia.swift to create CurrencyPair in Order init to avoid redundant code.
static let Bitcoin = Currency(name: "Bitcoin", code: "BTC") | ||
static let Ethereum = Currency(name: "Ethereum", code: "ETH") | ||
static let Litecoin = Currency(name: "Litecoin", code: "LTC") | ||
static let Ripple = Currency(name: "Ripple", code: "XRP") | ||
static let Cardano = Currency(name: "Cardano", code: "ADA") | ||
static let NEM = Currency(name: "NEM", code: "XEM") | ||
static let USDT = Currency(name: "Tether USD", code: "USDT") | ||
static let ETC = Currency(name: "Ethereum Classic", code: "ETC") | ||
static let BCH = Currency(name: "Bitcoin Cash", code: "BCH") | ||
static let DOGE = Currency(name: "Dogecoin", code: "DOGE") |
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.
Could you please remove these altcoin currency static members, since I've already added several of them in 0.0.4? Also, I would like to name them using the name instead of their code. Like bitcoin
instead of BTC
. (I know USDT is a typo there. Will rename it as USDTether in future release, Also, NEM is an exception there)
case Sell = "Sell" | ||
} | ||
|
||
public protocol OrderProtocol { |
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.
Move OrderProtocol and Order class into its own file, say, OpenOrder.swift
var rate: NSDecimalNumber? { get } | ||
} | ||
|
||
open class Order: OrderProtocol { |
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.
Rename Order to OpenOrder. Reason: To distinguish between completed Orders.
if apiType.checkInterval(response: store.openOrdersResponse) { | ||
completion(.cached) | ||
} else { | ||
cryptopiaDataTaskFor(api: apiType) { (json, response, error) in |
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.
When you pull the new changes, you would see the new ResponseType as the parameter of dataTask completion block here. Could you fix this?
Hey trsathya, Thanks for the feedback. I will work on them and update the branch. I have more work in the pipeline that i will be submitting soon. Cheers, |
Hey @TerrickMansur (not trying to be pushy 😄 ) But, just want to say hi and ask about how the PR is coming along. |
Creates an OrderModel and OrderType enum. Adds openOrders to store. Implements getOpenOrders for Cryptopia.