-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
111 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Series+Ext.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
extension Series { | ||
convenience init(native: dxfg_series_t) { | ||
self.init(String(pointee: native.market_event.event_symbol)) | ||
|
||
self.eventTime = native.market_event.event_time | ||
self.eventFlags = native.event_flags | ||
self.index = native.index | ||
self.timeSequence = native.time_sequence | ||
self.expiration = native.expiration | ||
self.volatility = native.volatility | ||
self.callVolume = native.call_volume | ||
self.putVolume = native.put_volume | ||
self.putCallRatio = native.put_call_ratio | ||
self.forwardPrice = native.forward_price | ||
self.dividend = native.dividend | ||
self.interest = native.interest | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// SeriesMapper.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class SeriesMapper: Mapper { | ||
let type = dxfg_series_t.self | ||
|
||
func fromNative(native: UnsafeMutablePointer<dxfg_event_type_t>) -> MarketEvent? { | ||
let event = native.withMemoryRebound(to: type, capacity: 1) { native in | ||
return Series(native: native.pointee) | ||
} | ||
return event | ||
} | ||
|
||
func toNative(event: MarketEvent) -> UnsafeMutablePointer<dxfg_event_type_t>? { | ||
let pointer = UnsafeMutablePointer<TypeAlias>.allocate(capacity: 1) | ||
var pointee = pointer.pointee | ||
pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() | ||
pointee.market_event.event_time = event.eventTime | ||
|
||
let series = event.series | ||
|
||
pointee.index = series.index | ||
pointee.event_flags = series.eventFlags | ||
pointee.time_sequence = series.timeSequence | ||
pointee.expiration = series.expiration | ||
pointee.volatility = series.volatility | ||
pointee.call_volume = series.callVolume | ||
pointee.put_volume = series.putVolume | ||
pointee.put_call_ratio = series.putCallRatio | ||
pointee.forward_price = series.forwardPrice | ||
pointee.dividend = series.dividend | ||
pointee.interest = series.interest | ||
|
||
let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in | ||
pointer.pointee.clazz = DXFG_EVENT_SERIES | ||
return pointer | ||
} | ||
return eventType | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.