Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Develop #6

wants to merge 4 commits into from

Conversation

TerrickMansur
Copy link

Creates an OrderModel and OrderType enum. Adds openOrders to store. Implements getOpenOrders for Cryptopia.

@trsathya
Copy link
Owner

@TerrickMansur Could you pull the latest changes and resolve conflicts, please?

Copy link
Owner

@trsathya trsathya left a 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"
Copy link
Owner

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 {
Copy link
Owner

@trsathya trsathya Jan 28, 2018

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: "/")
Copy link
Owner

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")
Copy link
Owner

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 {
Copy link
Owner

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 {
Copy link
Owner

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
Copy link
Owner

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?

@TerrickMansur
Copy link
Author

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,

@trsathya
Copy link
Owner

trsathya commented Mar 17, 2018

Hey @TerrickMansur (not trying to be pushy 😄 ) But, just want to say hi and ask about how the PR is coming along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants