Skip to content

Commit a2dad7a

Browse files
committed
Migration to Decimal64 2
1 parent f20711f commit a2dad7a

110 files changed

Lines changed: 2104 additions & 2615 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IG/IG.xcodeproj/project.pbxproj

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
8D376D64234C6210007D4A48 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D52F34222FB201000521759 /* Client.swift */; };
5353
8D376D65234C6210007D4A48 /* Market.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D47E0D623159C8900AD53A2 /* Market.swift */; };
5454
8D376D66234C6210007D4A48 /* MarketExpiry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D45267A233AC0190034D577 /* MarketExpiry.swift */; };
55-
8D376D67234C6210007D4A48 /* Deal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3E122FC789B00BB6261 /* Deal.swift */; };
55+
8D376D67234C6210007D4A48 /* DealIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3E122FC789B00BB6261 /* DealIdentifier.swift */; };
5656
8D376D68234C6210007D4A48 /* DealLimit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3DD22FC72E400BB6261 /* DealLimit.swift */; };
5757
8D376D69234C6210007D4A48 /* DealStop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3DF22FC72FE00BB6261 /* DealStop.swift */; };
5858
8D376D6A234C6210007D4A48 /* Confirmation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24D0D1230EF496003D25EA /* Confirmation.swift */; };
@@ -145,6 +145,10 @@
145145
8D3872552361F271005AD120 /* APIPriceBatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3872532361F25A005AD120 /* APIPriceBatch.swift */; };
146146
8D3872562361F278005AD120 /* APICalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3872522361F21F005AD120 /* APICalendar.swift */; };
147147
8D3872572361F27B005AD120 /* APIPriceBatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3872532361F25A005AD120 /* APIPriceBatch.swift */; };
148+
8D3CE53F247A5DCB0097BED7 /* DealReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3CE53E247A5DCB0097BED7 /* DealReference.swift */; };
149+
8D3CE540247A5DCB0097BED7 /* DealReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3CE53E247A5DCB0097BED7 /* DealReference.swift */; };
150+
8D3CE542247A5E3A0097BED7 /* Deal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3CE541247A5E3A0097BED7 /* Deal.swift */; };
151+
8D3CE543247A5E3A0097BED7 /* Deal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3CE541247A5E3A0097BED7 /* Deal.swift */; };
148152
8D452657233A3D270034D577 /* SQLite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D19C51E232694DC00F029B3 /* SQLite.swift */; };
149153
8D452658233A3D280034D577 /* SQLite+Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D30D08023240B0C00D83E0A /* SQLite+Result.swift */; };
150154
8D452659233A3ECF0034D577 /* Currency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D74741422E8439B00B0BA41 /* Currency.swift */; };
@@ -156,7 +160,7 @@
156160
8D45266A233A69390034D577 /* ErrorHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D19C51A2326459000F029B3 /* ErrorHelper.swift */; };
157161
8D45266B233A693C0034D577 /* ErrorCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D30D082232566D900D83E0A /* ErrorCodable.swift */; };
158162
8D45266E233A6A740034D577 /* Market.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D47E0D623159C8900AD53A2 /* Market.swift */; };
159-
8D452672233A6CC80034D577 /* Deal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3E122FC789B00BB6261 /* Deal.swift */; };
163+
8D452672233A6CC80034D577 /* DealIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3E122FC789B00BB6261 /* DealIdentifier.swift */; };
160164
8D452673233A6CE50034D577 /* DealLimit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3DD22FC72E400BB6261 /* DealLimit.swift */; };
161165
8D452674233A6CF00034D577 /* DealStop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DE2C3DF22FC72FE00BB6261 /* DealStop.swift */; };
162166
8D452677233A6F640034D577 /* Confirmation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24D0D1230EF496003D25EA /* Confirmation.swift */; };
@@ -331,6 +335,8 @@
331335
8D3C262422E9FA020080D3C1 /* Collections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Collections.swift; sourceTree = "<group>"; };
332336
8D3C262622E9FAC20080D3C1 /* StreamerInternals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamerInternals.swift; sourceTree = "<group>"; };
333337
8D3C262B22EB18A50080D3C1 /* Money.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Money.swift; sourceTree = "<group>"; };
338+
8D3CE53E247A5DCB0097BED7 /* DealReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DealReference.swift; sourceTree = "<group>"; };
339+
8D3CE541247A5E3A0097BED7 /* Deal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deal.swift; sourceTree = "<group>"; };
334340
8D45265E233A55FC0034D577 /* Bundle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Bundle.h; sourceTree = "<group>"; };
335341
8D45265F233A55FC0034D577 /* Bundle.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Bundle.c; sourceTree = "<group>"; };
336342
8D452667233A67960034D577 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
@@ -449,7 +455,7 @@
449455
8DDBE9FE2350825F001773D2 /* ServicesError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServicesError.swift; sourceTree = "<group>"; };
450456
8DE2C3DD22FC72E400BB6261 /* DealLimit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DealLimit.swift; sourceTree = "<group>"; };
451457
8DE2C3DF22FC72FE00BB6261 /* DealStop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DealStop.swift; sourceTree = "<group>"; };
452-
8DE2C3E122FC789B00BB6261 /* Deal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deal.swift; sourceTree = "<group>"; };
458+
8DE2C3E122FC789B00BB6261 /* DealIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DealIdentifier.swift; sourceTree = "<group>"; };
453459
8DE4A67022FB40890036CF5E /* APIMarketStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIMarketStatus.swift; sourceTree = "<group>"; };
454460
8DE4A67222FB40CF0036CF5E /* APINodeMarket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APINodeMarket.swift; sourceTree = "<group>"; };
455461
8DE50471245AD09C001BD304 /* UnfairLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnfairLock.swift; sourceTree = "<group>"; };
@@ -773,7 +779,9 @@
773779
8D52F34222FB201000521759 /* Client.swift */,
774780
8D47E0D623159C8900AD53A2 /* Market.swift */,
775781
8D45267A233AC0190034D577 /* MarketExpiry.swift */,
776-
8DE2C3E122FC789B00BB6261 /* Deal.swift */,
782+
8D3CE541247A5E3A0097BED7 /* Deal.swift */,
783+
8DE2C3E122FC789B00BB6261 /* DealIdentifier.swift */,
784+
8D3CE53E247A5DCB0097BED7 /* DealReference.swift */,
777785
8DE2C3DD22FC72E400BB6261 /* DealLimit.swift */,
778786
8DE2C3DF22FC72FE00BB6261 /* DealStop.swift */,
779787
8D24D0D1230EF496003D25EA /* Confirmation.swift */,
@@ -1295,7 +1303,7 @@
12951303
8D33B8D72339689E002B524B /* Client.swift in Sources */,
12961304
8D45266E233A6A740034D577 /* Market.swift in Sources */,
12971305
8D45267C233AC0190034D577 /* MarketExpiry.swift in Sources */,
1298-
8D452672233A6CC80034D577 /* Deal.swift in Sources */,
1306+
8D452672233A6CC80034D577 /* DealIdentifier.swift in Sources */,
12991307
8D88F5FA246C79D900743B2B /* UTC.swift in Sources */,
13001308
8D452673233A6CE50034D577 /* DealLimit.swift in Sources */,
13011309
8D452674233A6CF00034D577 /* DealStop.swift in Sources */,
@@ -1325,6 +1333,7 @@
13251333
8DAC346E233D196A0082DB1C /* APIAccounts.swift in Sources */,
13261334
8D7AB05C233F43AE00439CA1 /* APIActivity.swift in Sources */,
13271335
8DFEC5F1234078F7005906B3 /* APITransaction.swift in Sources */,
1336+
8D3CE540247A5DCB0097BED7 /* DealReference.swift in Sources */,
13281337
8DFEC5F2234080B7005906B3 /* APIPrice.swift in Sources */,
13291338
8DFEC5F423409600005906B3 /* APINode.swift in Sources */,
13301339
8DFEC5F323408459005906B3 /* APIMarket.swift in Sources */,
@@ -1343,6 +1352,7 @@
13431352
8D89C791234320FE00FD0F3D /* StreamerCredentials.swift in Sources */,
13441353
8D89C792234320FF00FD0F3D /* StreamerSubscription.swift in Sources */,
13451354
8D89C793234320FF00FD0F3D /* StreamerEvent.swift in Sources */,
1355+
8D3CE543247A5E3A0097BED7 /* Deal.swift in Sources */,
13461356
8D89C7942343210B00FD0F3D /* StreamerSession.swift in Sources */,
13471357
8D89C7952343210B00FD0F3D /* StreamerChannel.swift in Sources */,
13481358
8D286D272344C8D000D582AE /* StreamerMarket.swift in Sources */,
@@ -1430,7 +1440,7 @@
14301440
8D376D64234C6210007D4A48 /* Client.swift in Sources */,
14311441
8D376D65234C6210007D4A48 /* Market.swift in Sources */,
14321442
8D376D66234C6210007D4A48 /* MarketExpiry.swift in Sources */,
1433-
8D376D67234C6210007D4A48 /* Deal.swift in Sources */,
1443+
8D376D67234C6210007D4A48 /* DealIdentifier.swift in Sources */,
14341444
8D88F5F9246C79D900743B2B /* UTC.swift in Sources */,
14351445
8D376D68234C6210007D4A48 /* DealLimit.swift in Sources */,
14361446
8D376D69234C6210007D4A48 /* DealStop.swift in Sources */,
@@ -1460,6 +1470,7 @@
14601470
8D376D7F234C62A3007D4A48 /* APIAccounts.swift in Sources */,
14611471
8D376D80234C62A3007D4A48 /* APIActivity.swift in Sources */,
14621472
8D376D81234C62A3007D4A48 /* APITransaction.swift in Sources */,
1473+
8D3CE53F247A5DCB0097BED7 /* DealReference.swift in Sources */,
14631474
8D376D82234C62A3007D4A48 /* APIPrice.swift in Sources */,
14641475
8D376D83234C62A3007D4A48 /* APINode.swift in Sources */,
14651476
8D376D84234C62A3007D4A48 /* APIMarket.swift in Sources */,
@@ -1478,6 +1489,7 @@
14781489
8D376D90234C62DA007D4A48 /* StreamerCredentials.swift in Sources */,
14791490
8D376D91234C62DA007D4A48 /* StreamerSubscription.swift in Sources */,
14801491
8D376D92234C62DA007D4A48 /* StreamerEvent.swift in Sources */,
1492+
8D3CE542247A5E3A0097BED7 /* Deal.swift in Sources */,
14811493
8D376D93234C62DA007D4A48 /* StreamerSession.swift in Sources */,
14821494
8D376D94234C62DA007D4A48 /* StreamerChannel.swift in Sources */,
14831495
8D376D95234C62DA007D4A48 /* StreamerMarket.swift in Sources */,

IG/sources/api/API.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ public final class API {
1111
/// The queue processing and delivering server values.
1212
internal final let queue: DispatchQueue
1313
/// The URL Session instance for performing HTTPS requests.
14-
internal final let channel: IG.API.Channel
14+
internal final let channel: API.Channel
1515

1616
/// Namespace for endpoints related to the current API session (e.g. log in/out, refresh token, etc.).
17-
@inlinable public final var session: IG.API.Request.Session { .init(api: self) }
17+
@inlinable public final var session: API.Request.Session { .init(api: self) }
1818
/// Namespace for endpoints related to the user's account/s (e.g. account info, transactions, activity, etc.).
19-
@inlinable public final var accounts: IG.API.Request.Accounts { .init(api: self) }
19+
@inlinable public final var accounts: API.Request.Accounts { .init(api: self) }
2020
/// Namespace for endpoints related to the IG markets (e.g. market info, snapshots, etc.).
21-
@inlinable public final var markets: IG.API.Request.Markets { .init(api: self) }
21+
@inlinable public final var markets: API.Request.Markets { .init(api: self) }
2222
/// Namespace for endpoints related to price data point retrieval (e.g. return all data points for EUR/USD market with resolution of 1 minute).
23-
@inlinable public final var price: IG.API.Request.Price { .init(api: self) }
23+
@inlinable public final var price: API.Request.Price { .init(api: self) }
2424
/// Namespace for endpoints related to open positions (e.g. create a position, tweak it, or close it).
25-
@inlinable public final var positions: IG.API.Request.Positions { .init(api: self) }
25+
@inlinable public final var positions: API.Request.Positions { .init(api: self) }
2626
/// Namespace for endpoints related to open working orders (e.g. create a working order, tweak it, or close it).
27-
@inlinable public final var workingOrders: IG.API.Request.WorkingOrders { .init(api: self) }
27+
@inlinable public final var workingOrders: API.Request.WorkingOrders { .init(api: self) }
2828
/// Namespace for endpoints related to IG nodes; that is what IG uses to navigate its tree of available markets.
29-
@inlinable public final var nodes: IG.API.Request.Nodes { .init(api: self) }
29+
@inlinable public final var nodes: API.Request.Nodes { .init(api: self) }
3030
/// Namespace for endpoints related to watchlist management (e.g. create/remove watchlist, add/remove markets to it, etc.).
31-
@inlinable public final var watchlists: IG.API.Request.Watchlists { .init(api: self) }
31+
@inlinable public final var watchlists: API.Request.Watchlists { .init(api: self) }
3232
/// Namespace for endpoints related to endpoints scrapped from IG website (e.g. economic calendar).
33-
@inlinable public final var scrapped: IG.API.Request.Scrapped { .init(api: self) }
33+
@inlinable public final var scrapped: API.Request.Scrapped { .init(api: self) }
3434

3535
/// Initializer for an API instance, giving you the default options.
3636
///
@@ -39,11 +39,11 @@ public final class API {
3939
/// - parameter credentials: `nil` for yet unknown credentials (most of the cases); otherwise, use your hard-coded credentials.
4040
/// - parameter targetQueue: The target queue on which to process the `API` requests and responses.
4141
/// - parameter qos: The Quality of Service for the API processing queue.
42-
public convenience init(rootURL: URL, credentials: IG.API.Credentials?, targetQueue: DispatchQueue?, qos: DispatchQoS) {
42+
public convenience init(rootURL: URL, credentials: API.Credentials?, targetQueue: DispatchQueue?, qos: DispatchQoS) {
4343
// - warning: If the `URLSession` is ever to have a delegate, `processingQueue` must be serial. Otherwise, the delegate message wouldn't be ordered.
4444
let processingQueue = DispatchQueue(label: Self.reverseDNS + ".queue", qos: qos, attributes: .init(), autoreleaseFrequency: .inherit, target: targetQueue)
4545
let operationQueue = OperationQueue(name: Self.reverseDNS + ".operationQueue", underlyingQueue: processingQueue)
46-
let session = URLSession(configuration: IG.API.Channel.defaultSessionConfigurations, delegate: nil, delegateQueue: operationQueue)
46+
let session = URLSession(configuration: API.Channel.defaultSessionConfigurations, delegate: nil, delegateQueue: operationQueue)
4747
self.init(rootURL: rootURL, credentials: credentials, queue: processingQueue, session: session)
4848
}
4949

@@ -52,14 +52,14 @@ public final class API {
5252
/// - parameter credentials: `nil` for yet unknown credentials (most of the cases); otherwise, use your hard-coded credentials.
5353
/// - parameter session: The URL session used to call the real (or mocked) endpoints.
5454
/// - parameter queue: The `DispatchQueue` actually handling the `API` requests and responses. It is also the delegate `OperationQueue`'s underlying queue.
55-
internal init(rootURL: URL, credentials: IG.API.Credentials?, queue: DispatchQueue, session: URLSession) {
55+
internal init(rootURL: URL, credentials: API.Credentials?, queue: DispatchQueue, session: URLSession) {
5656
self.rootURL = rootURL
5757
self.queue = queue
5858
self.channel = .init(session: session, credentials: credentials, scheduler: queue)
5959
}
6060
}
6161

62-
extension IG.API {
62+
extension API {
6363
/// The root address for the publicly accessible endpoints.
6464
public static let rootURL = URL(string: "https://api.ig.com/gateway/deal")!
6565
/// The root URL for the hidden endpoints.
@@ -68,7 +68,7 @@ extension IG.API {
6868
internal static var reverseDNS: String { Bundle.IG.identifier + ".api" }
6969
}
7070

71-
extension IG.API: IG.DebugDescriptable {
71+
extension API: IG.DebugDescriptable {
7272
internal static var printableDomain: String { "\(Bundle.IG.name).\(Self.self)" }
7373

7474
public final var debugDescription: String {

IG/sources/api/APIError.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
extension IG.API {
3+
extension API {
44
/// Wraps any error generated by the API request/response system.
55
///
66
/// When `underlyingError` is set, most of them will be coming from a `URLSession` or sent when encoding/decoding JSONs.
@@ -54,7 +54,7 @@ extension IG.API {
5454
}
5555
}
5656

57-
extension IG.API.Error {
57+
extension API.Error {
5858
/// The type of API error raised.
5959
public enum Kind: CaseIterable {
6060
/// The API/URLSession experied before the endpoint call could finish.
@@ -112,7 +112,7 @@ extension IG.API.Error {
112112
}
113113
}
114114

115-
extension IG.API.Error {
115+
extension API.Error {
116116
/// Namespace for messages reused over the framework.
117117
internal struct Message: IG.ErrorNameSpace {
118118
let rawValue: String; init(_ trustedValue: String) { self.rawValue = trustedValue }
@@ -157,8 +157,8 @@ extension IG.API.Error {
157157
}
158158
}
159159

160-
extension IG.API.Error: IG.ErrorPrintable {
161-
internal static var printableDomain: String { "\(IG.API.printableDomain).\(Self.self)" }
160+
extension API.Error: IG.ErrorPrintable {
161+
internal static var printableDomain: String { "\(API.printableDomain).\(Self.self)" }
162162

163163
internal var printableType: String {
164164
switch self.type {

0 commit comments

Comments
 (0)