Skip to content

Commit

Permalink
Merge branch 'swift' into feature/ipf
Browse files Browse the repository at this point in the history
# Conflicts:
#	DXFeedFramework/Api/DXEndpoint.swift
  • Loading branch information
kosyloa committed Sep 8, 2023
2 parents f8623b8 + 3e38acf commit 43a99f7
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 68 deletions.
6 changes: 5 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
cyclomatic_complexity:
ignores_case_statements: true
ignores_case_statements: true
file_length:
warning: 800
error: 1500

422 changes: 365 additions & 57 deletions DXFeedFramework/Api/DXEndpoint.swift

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DXFeedFramework/Api/DXPublisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

class DXPublisher {
public class DXPublisher {
#warning("TODO: implement it")

}
4 changes: 2 additions & 2 deletions DXFeedFramework/Api/Osub/WildcardSymbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

class WildcardSymbol: Symbol {
public class WildcardSymbol: Symbol {
static let reservedPrefix = "*"
private let symbol: String

Expand All @@ -17,7 +17,7 @@ class WildcardSymbol: Symbol {
self.symbol = symbol
}

var stringValue: String {
public var stringValue: String {
return symbol
}
}
4 changes: 4 additions & 0 deletions DXFeedFramework/Native/Endpoint/NativeEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class NativeEndpoint {
let thread = currentThread()
try ErrorCheck.nativeCall(thread, dxfg_DXEndpoint_close(thread, self.endpoint))
}
func closeAndAWaitTermination() throws {
let thread = currentThread()
try ErrorCheck.nativeCall(thread, dxfg_DXEndpoint_closeAndAwaitTermination(thread, self.endpoint))
}
func set(password: String) throws {
let thread = currentThread()
try ErrorCheck.nativeCall(thread, dxfg_DXEndpoint_password(thread, self.endpoint, password.toCStringRef()))
Expand Down
15 changes: 12 additions & 3 deletions DXFeedFrameworkTests/EndpointTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class EndpointTest: XCTestCase {

override class func setUp() {
publisherEndpoint = try? DXEndpoint.builder().withRole(.publisher).withProperty("test", "value").build()
try? publisherEndpoint?.connect(":\(EndpointTest.port)")
_ = try? publisherEndpoint?.connect(":\(EndpointTest.port)")
}

override class func tearDown() {
Expand Down Expand Up @@ -67,17 +67,26 @@ final class EndpointTest: XCTestCase {
func testListenerDealloc() throws {
var endpoint: DXEndpoint? = try DXEndpoint.builder().withRole(.feed).withProperty("test", "value").build()
XCTAssertNotNil(endpoint, "Endpoint should be not nil")
try endpoint?.connect(endpointAddress)
_ = try endpoint?.connect(endpointAddress)
var state = try? endpoint?.getState()
try endpoint?.close()
try endpoint?.disconnect()
wait(seconds: 2)
try? endpoint?.callGC()
state = try? endpoint?.getState()
try endpoint?.close()
state = try? endpoint?.getState()
try? endpoint?.callGC()
try endpoint?.close()
state = try? endpoint?.getState()
try? endpoint?.callGC()
state = try? endpoint?.getState()
endpoint = nil
endpoint = try DXEndpoint.builder().withRole(.feed).withProperty("test", "value").build()
XCTAssertNotNil(endpoint, "Endpoint should be not nil")
try endpoint?.connect(endpointAddress)
_ = try endpoint?.connect(endpointAddress)
try endpoint?.disconnect()
print("\(state ?? .notConnected)")
wait(seconds: 3)
}

Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import PackageDescription

let version = "0.0.5_build"
let version = "0.0.6"
let moduleName = "DXFeedFramework"
let checksum = "d0ca97892afa6abd04c5b5138ceec721bc8ef59aacbb8a8ae12c27a5643de60d"
let checksum = "27d29031a467dd41c196e96d739103ceee1de84c4f2335922b7be4ac4fd111cb"

let package = Package(
name: moduleName,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ Quote{AAPL, eventTime=0, time=20221219-223312.000, timeNanoPart=0, sequence=0, b
is a snapshot of the price and size of the last trade during extended trading hours and the extended trading hours day
volume and day turnover

- [ ] [Candle](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/candle/Candle.html)
- [x] [Candle](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/candle/Candle.html)
event with open, high, low, and close prices and other information for a specific period

- [ ] [Quote](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/market/Quote.html)
- [x] [Quote](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/market/Quote.html)
is a snapshot of the best bid and ask prices and other fields that change with each quote

- [ ] [Profile](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/market/Profile.html)
Expand Down

0 comments on commit 43a99f7

Please sign in to comment.