-
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
17 changed files
with
404 additions
and
5 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
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
37 changes: 37 additions & 0 deletions
37
DXFeedFramework/Native/Events/Markets/AnalyticOrder+Ext.swift
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,37 @@ | ||
// | ||
// AnalyticOrder+Ext.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
extension AnalyticOrder { | ||
convenience init(native: dxfg_analytic_order_t) { | ||
self.init(String(pointee: native.order_base.order_base.market_event.event_symbol)) | ||
|
||
self.eventTime = native.order_base.order_base.market_event.event_time | ||
self.eventFlags = native.order_base.order_base.event_flags | ||
self.index = native.order_base.order_base.index | ||
self.timeSequence = native.order_base.order_base.time_sequence | ||
self.timeNanoPart = native.order_base.order_base.time_nano_part | ||
self.actionTime = native.order_base.order_base.action_time | ||
self.orderId = native.order_base.order_base.order_id | ||
self.auxOrderId = native.order_base.order_base.aux_order_id | ||
self.price = native.order_base.order_base.price | ||
self.size = native.order_base.order_base.size | ||
self.executedSize = native.order_base.order_base.executed_size | ||
self.count = native.order_base.order_base.count | ||
self.flags = native.order_base.order_base.flags | ||
self.tradeId = native.order_base.order_base.trade_id | ||
self.tradePrice = native.order_base.order_base.trade_price | ||
self.tradeSize = native.order_base.order_base.trade_size | ||
|
||
self.icebergPeakSize = native.iceberg_peak_size | ||
self.icebergHiddenSize = native.iceberg_hidden_size | ||
self.icebergExecutedSize = native.iceberg_executed_size | ||
self.icebergFlags = native.iceberg_flags | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
DXFeedFramework/Native/Events/Markets/AnalyticOrderMapper.swift
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,57 @@ | ||
// | ||
// AnalyticOrderMapper.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class AnalyticOrderMapper: Mapper { | ||
let type = dxfg_analytic_order_t.self | ||
|
||
func fromNative(native: UnsafeMutablePointer<dxfg_event_type_t>) -> MarketEvent? { | ||
let event = native.withMemoryRebound(to: type, capacity: 1) { native in | ||
return AnalyticOrder(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.order_base.order_base.market_event.event_symbol = event.eventSymbol.toCStringRef() | ||
pointee.order_base.order_base.market_event.event_time = event.eventTime | ||
|
||
let order = event.analyticOrder | ||
|
||
pointee.order_base.order_base.market_event.event_time = order.eventTime | ||
pointee.order_base.order_base.event_flags = order.eventFlags | ||
pointee.order_base.order_base.index = order.index | ||
pointee.order_base.order_base.time_sequence = order.timeSequence | ||
pointee.order_base.order_base.time_nano_part = order.timeNanoPart | ||
pointee.order_base.order_base.action_time = order.actionTime | ||
pointee.order_base.order_base.order_id = order.orderId | ||
pointee.order_base.order_base.aux_order_id = order.auxOrderId | ||
pointee.order_base.order_base.price = order.price | ||
pointee.order_base.order_base.size = order.size | ||
pointee.order_base.order_base.executed_size = order.executedSize | ||
pointee.order_base.order_base.count = order.count | ||
pointee.order_base.order_base.flags = order.flags | ||
pointee.order_base.order_base.trade_id = order.tradeId | ||
pointee.order_base.order_base.trade_price = order.tradePrice | ||
pointee.order_base.order_base.trade_size = order.tradeSize | ||
|
||
pointee.iceberg_peak_size = order.icebergPeakSize | ||
pointee.iceberg_hidden_size = order.icebergHiddenSize | ||
pointee.iceberg_executed_size = order.icebergExecutedSize | ||
pointee.iceberg_flags = order.icebergFlags | ||
|
||
let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in | ||
pointer.pointee.clazz = DXFG_EVENT_ANALYTIC_ORDER | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Order+Ext.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
extension Order { | ||
convenience init(native: dxfg_order_t) { | ||
self.init(String(pointee: native.order_base.market_event.event_symbol)) | ||
|
||
self.eventTime = native.order_base.market_event.event_time | ||
self.eventFlags = native.order_base.event_flags | ||
self.index = native.order_base.index | ||
self.timeSequence = native.order_base.time_sequence | ||
self.timeNanoPart = native.order_base.time_nano_part | ||
self.actionTime = native.order_base.action_time | ||
self.orderId = native.order_base.order_id | ||
self.auxOrderId = native.order_base.aux_order_id | ||
self.price = native.order_base.price | ||
self.size = native.order_base.size | ||
self.executedSize = native.order_base.executed_size | ||
self.count = native.order_base.count | ||
self.flags = native.order_base.flags | ||
self.tradeId = native.order_base.trade_id | ||
self.tradePrice = native.order_base.trade_price | ||
self.tradeSize = native.order_base.trade_size | ||
|
||
self.marketMaker = String(pointee: native.market_maker) | ||
} | ||
} |
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,54 @@ | ||
// | ||
// OrderMapper.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 12.10.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class OrderMapper: Mapper { | ||
let type = dxfg_order_t.self | ||
|
||
func fromNative(native: UnsafeMutablePointer<dxfg_event_type_t>) -> MarketEvent? { | ||
let event = native.withMemoryRebound(to: type, capacity: 1) { native in | ||
return Order(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.order_base.market_event.event_symbol = event.eventSymbol.toCStringRef() | ||
pointee.order_base.market_event.event_time = event.eventTime | ||
|
||
let order = event.order | ||
|
||
pointee.order_base.market_event.event_time = order.eventTime | ||
pointee.order_base.event_flags = order.eventFlags | ||
pointee.order_base.index = order.index | ||
pointee.order_base.time_sequence = order.timeSequence | ||
pointee.order_base.time_nano_part = order.timeNanoPart | ||
pointee.order_base.action_time = order.actionTime | ||
pointee.order_base.order_id = order.orderId | ||
pointee.order_base.aux_order_id = order.auxOrderId | ||
pointee.order_base.price = order.price | ||
pointee.order_base.size = order.size | ||
pointee.order_base.executed_size = order.executedSize | ||
pointee.order_base.count = order.count | ||
pointee.order_base.flags = order.flags | ||
pointee.order_base.trade_id = order.tradeId | ||
pointee.order_base.trade_price = order.tradePrice | ||
pointee.order_base.trade_size = order.tradeSize | ||
|
||
pointee.market_maker = order.marketMaker?.toCStringRef() | ||
|
||
let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in | ||
pointer.pointee.clazz = DXFG_EVENT_ORDER | ||
return pointer | ||
} | ||
return eventType | ||
} | ||
} |
Oops, something went wrong.