Skip to content

Develop#6

Open
TerrickMansur wants to merge 4 commits into
trsathya:masterfrom
TerrickMansur:develop
Open

Develop#6
TerrickMansur wants to merge 4 commits into
trsathya:masterfrom
TerrickMansur:develop

Conversation

@TerrickMansur

Copy link
Copy Markdown

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

@trsathya

Copy link
Copy Markdown
Owner

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

@trsathya trsathya left a comment

Copy link
Copy Markdown
Owner

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?

Comment thread Common/Balance.swift
import Foundation

public enum OrderType: String {
case Buy = "Buy"

Copy link
Copy Markdown
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.

Comment thread Cryptopia/Cryptopia.swift
}
}

public class CryptopiaOrder: Order {

@trsathya trsathya Jan 28, 2018

Copy link
Copy Markdown
Owner

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.

Comment thread Cryptopia/Cryptopia.swift
self.remaining = NSDecimalNumber(json["Remaining"])
self.total = NSDecimalNumber(json["Total"])
if let market = json["Market"] as? String {
let split = market.components(separatedBy: "/")

Copy link
Copy Markdown
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.

Comment thread Common/Currency.swift
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
Copy Markdown
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)

Comment thread Common/Balance.swift
case Sell = "Sell"
}

public protocol OrderProtocol {

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

Comment thread Common/Balance.swift
var rate: NSDecimalNumber? { get }
}

open class Order: OrderProtocol {

Copy link
Copy Markdown
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.

Comment thread Cryptopia/Cryptopia.swift
if apiType.checkInterval(response: store.openOrdersResponse) {
completion(.cached)
} else {
cryptopiaDataTaskFor(api: apiType) { (json, response, error) in

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

trsathya commented Mar 17, 2018

Copy link
Copy Markdown
Owner

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