diff --git a/DXFeedFramework.xcodeproj/project.pbxproj b/DXFeedFramework.xcodeproj/project.pbxproj index e84113cd3..6459e0e48 100644 --- a/DXFeedFramework.xcodeproj/project.pbxproj +++ b/DXFeedFramework.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ 645BE84F2AC3170F0028243D /* DXFeedFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 803BAC0D29BFA50700FFAB1C /* DXFeedFramework.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 645BE8522AC31E7C0028243D /* PerfTestCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645BE8512AC31E7C0028243D /* PerfTestCommand.swift */; }; 645BE8542AC3229D0028243D /* ToolsCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645BE8532AC3229D0028243D /* ToolsCommand.swift */; }; + 645CD0042AE145E600F99FCF /* DumpCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645CD0032AE145E600F99FCF /* DumpCommand.swift */; }; 646228512A376B0A0029DC97 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6462284D2A376B0A0029DC97 /* Main.storyboard */; }; 646228522A376B0A0029DC97 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6462284F2A376B0A0029DC97 /* LaunchScreen.storyboard */; }; 646407492A9DF984006FF769 /* InstrumentProfileMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 646407482A9DF984006FF769 /* InstrumentProfileMapper.swift */; }; @@ -619,6 +620,7 @@ 645A34942A937C7200709F29 /* BinaryInteger+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BinaryInteger+Ext.swift"; sourceTree = ""; }; 645BE8512AC31E7C0028243D /* PerfTestCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerfTestCommand.swift; sourceTree = ""; }; 645BE8532AC3229D0028243D /* ToolsCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolsCommand.swift; sourceTree = ""; }; + 645CD0032AE145E600F99FCF /* DumpCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DumpCommand.swift; sourceTree = ""; }; 6462284E2A376B0A0029DC97 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 646228502A376B0A0029DC97 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 646407482A9DF984006FF769 /* InstrumentProfileMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstrumentProfileMapper.swift; sourceTree = ""; }; @@ -937,6 +939,7 @@ 6486B97E2AD4167800D8D5FA /* LiveIpfCommand.swift */, 64FFE59E2AD430E4003D3353 /* ScheduleCommand.swift */, 649282E92AD55323008F0F04 /* IpfConnectCommand.swift */, + 645CD0032AE145E600F99FCF /* DumpCommand.swift */, 648BD56A2AC4576F004A3A95 /* HelpCommand.swift */, 648BD56C2AC56A04004A3A95 /* SubscriptionUtils.swift */, ); @@ -1983,6 +1986,7 @@ 649282EB2AD55323008F0F04 /* IpfConnectCommand.swift in Sources */, 6486B97F2AD4167800D8D5FA /* LiveIpfCommand.swift in Sources */, 645BE8522AC31E7C0028243D /* PerfTestCommand.swift in Sources */, + 645CD0042AE145E600F99FCF /* DumpCommand.swift in Sources */, 641BDD5D2ACD67A000236B78 /* LatencyListener.swift in Sources */, 641BDD622ACD697B00236B78 /* AbstractEventListener.swift in Sources */, 641BDD582AC71CCE00236B78 /* LatencyTestCommand.swift in Sources */, diff --git a/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/Tools.xcscheme b/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/Tools.xcscheme index 27d8bcb2f..d09d7d243 100644 --- a/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/Tools.xcscheme +++ b/DXFeedFramework.xcodeproj/xcshareddata/xcschemes/Tools.xcscheme @@ -30,7 +30,7 @@ shouldAutocreateTestPlan = "YES"> + + UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.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 + pointer.pointee.order_base.order_base.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.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 + pointer.pointee.order_base.order_base.market_event.event_time = order.eventTime + pointer.pointee.order_base.order_base.event_flags = order.eventFlags + pointer.pointee.order_base.order_base.index = order.index + pointer.pointee.order_base.order_base.time_sequence = order.timeSequence + pointer.pointee.order_base.order_base.time_nano_part = order.timeNanoPart + pointer.pointee.order_base.order_base.action_time = order.actionTime + pointer.pointee.order_base.order_base.order_id = order.orderId + pointer.pointee.order_base.order_base.aux_order_id = order.auxOrderId + pointer.pointee.order_base.order_base.price = order.price + pointer.pointee.order_base.order_base.size = order.size + pointer.pointee.order_base.order_base.executed_size = order.executedSize + pointer.pointee.order_base.order_base.count = order.count + pointer.pointee.order_base.order_base.flags = order.flags + pointer.pointee.order_base.order_base.trade_id = order.tradeId + pointer.pointee.order_base.order_base.trade_price = order.tradePrice + pointer.pointee.order_base.order_base.trade_size = order.tradeSize + + pointer.pointee.iceberg_peak_size = order.icebergPeakSize + pointer.pointee.iceberg_hidden_size = order.icebergHiddenSize + pointer.pointee.iceberg_executed_size = order.icebergExecutedSize + pointer.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 diff --git a/DXFeedFramework/Native/Events/Markets/CandleMapper.swift b/DXFeedFramework/Native/Events/Markets/CandleMapper.swift index 91e68bd9c..5ef408344 100644 --- a/DXFeedFramework/Native/Events/Markets/CandleMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/CandleMapper.swift @@ -19,24 +19,23 @@ class CandleMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.event_symbol = event.eventSymbol.toCStringRef() - pointee.event_time = event.eventTime + pointer.pointee.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.event_time = event.eventTime let candle = event.candle - pointee.event_flags = candle.eventFlags - pointee.index = candle.index - pointee.count = candle.count - pointee.open = candle.open - pointee.high = candle.high - pointee.low = candle.low - pointee.close = candle.close - pointee.volume = candle.volume - pointee.vwap = candle.vwap - pointee.bid_volume = candle.bidVolume - pointee.ask_volume = candle.askVolume - pointee.imp_volatility = candle.impVolatility - pointee.open_interest = candle.openInterest + pointer.pointee.event_flags = candle.eventFlags + pointer.pointee.index = candle.index + pointer.pointee.count = candle.count + pointer.pointee.open = candle.open + pointer.pointee.high = candle.high + pointer.pointee.low = candle.low + pointer.pointee.close = candle.close + pointer.pointee.volume = candle.volume + pointer.pointee.vwap = candle.vwap + pointer.pointee.bid_volume = candle.bidVolume + pointer.pointee.ask_volume = candle.askVolume + pointer.pointee.imp_volatility = candle.impVolatility + pointer.pointee.open_interest = candle.openInterest let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_CANDLE diff --git a/DXFeedFramework/Native/Events/Markets/GreeksMapper.swift b/DXFeedFramework/Native/Events/Markets/GreeksMapper.swift index 19f251c12..dbda39dc4 100644 --- a/DXFeedFramework/Native/Events/Markets/GreeksMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/GreeksMapper.swift @@ -20,20 +20,19 @@ class GreeksMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let greeks = event.greeks - pointee.event_flags = greeks.eventFlags - pointee.index = greeks.index - pointee.price = greeks.price - pointee.volatility = greeks.volatility - pointee.delta = greeks.delta - pointee.gamma = greeks.gamma - pointee.theta = greeks.theta - pointee.rho = greeks.rho - pointee.vega = greeks.vega + pointer.pointee.event_flags = greeks.eventFlags + pointer.pointee.index = greeks.index + pointer.pointee.price = greeks.price + pointer.pointee.volatility = greeks.volatility + pointer.pointee.delta = greeks.delta + pointer.pointee.gamma = greeks.gamma + pointer.pointee.theta = greeks.theta + pointer.pointee.rho = greeks.rho + pointer.pointee.vega = greeks.vega let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_GREEKS diff --git a/DXFeedFramework/Native/Events/Markets/OptionSaleMapper.swift b/DXFeedFramework/Native/Events/Markets/OptionSaleMapper.swift index afc9be805..294cba543 100644 --- a/DXFeedFramework/Native/Events/Markets/OptionSaleMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/OptionSaleMapper.swift @@ -20,27 +20,26 @@ class OptionSaleMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let optionSale = event.optionSale - pointee.event_flags = optionSale.eventFlags - pointee.index = optionSale.index - pointee.time_sequence = optionSale.timeSequence - pointee.time_nano_part = optionSale.timeNanoPart - pointee.exchange_code = optionSale.exchangeCode - pointee.price = optionSale.price - pointee.size = optionSale.size - pointee.bid_price = optionSale.bidPrice - pointee.ask_price = optionSale.askPrice - pointee.exchange_sale_conditions = optionSale.exchangeSaleConditions.toCStringRef() - pointee.flags = optionSale.flags - pointee.underlying_price = optionSale.underlyingPrice - pointee.volatility = optionSale.volatility - pointee.delta = optionSale.delta - pointee.option_symbol = optionSale.optionSymbol.toCStringRef() + pointer.pointee.event_flags = optionSale.eventFlags + pointer.pointee.index = optionSale.index + pointer.pointee.time_sequence = optionSale.timeSequence + pointer.pointee.time_nano_part = optionSale.timeNanoPart + pointer.pointee.exchange_code = optionSale.exchangeCode + pointer.pointee.price = optionSale.price + pointer.pointee.size = optionSale.size + pointer.pointee.bid_price = optionSale.bidPrice + pointer.pointee.ask_price = optionSale.askPrice + pointer.pointee.exchange_sale_conditions = optionSale.exchangeSaleConditions.toCStringRef() + pointer.pointee.flags = optionSale.flags + pointer.pointee.underlying_price = optionSale.underlyingPrice + pointer.pointee.volatility = optionSale.volatility + pointer.pointee.delta = optionSale.delta + pointer.pointee.option_symbol = optionSale.optionSymbol.toCStringRef() let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_OPTION_SALE diff --git a/DXFeedFramework/Native/Events/Markets/OrderMapper.swift b/DXFeedFramework/Native/Events/Markets/OrderMapper.swift index 2d3642a50..c138da2a5 100644 --- a/DXFeedFramework/Native/Events/Markets/OrderMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/OrderMapper.swift @@ -20,30 +20,29 @@ class OrderMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.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 + pointer.pointee.order_base.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.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() + pointer.pointee.order_base.market_event.event_time = order.eventTime + pointer.pointee.order_base.event_flags = order.eventFlags + pointer.pointee.order_base.index = order.index + pointer.pointee.order_base.time_sequence = order.timeSequence + pointer.pointee.order_base.time_nano_part = order.timeNanoPart + pointer.pointee.order_base.action_time = order.actionTime + pointer.pointee.order_base.order_id = order.orderId + pointer.pointee.order_base.aux_order_id = order.auxOrderId + pointer.pointee.order_base.price = order.price + pointer.pointee.order_base.size = order.size + pointer.pointee.order_base.executed_size = order.executedSize + pointer.pointee.order_base.count = order.count + pointer.pointee.order_base.flags = order.flags + pointer.pointee.order_base.trade_id = order.tradeId + pointer.pointee.order_base.trade_price = order.tradePrice + pointer.pointee.order_base.trade_size = order.tradeSize + + pointer.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 diff --git a/DXFeedFramework/Native/Events/Markets/ProfileMapper.swift b/DXFeedFramework/Native/Events/Markets/ProfileMapper.swift index 71fb4c3a2..41d023b4f 100644 --- a/DXFeedFramework/Native/Events/Markets/ProfileMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/ProfileMapper.swift @@ -20,27 +20,26 @@ class ProfileMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let profile = event.profile - pointee.description = profile.descriptionStr?.toCStringRef() - pointee.status_reason = profile.statusReason?.toCStringRef() - pointee.halt_start_time = profile.haltStartTime - pointee.halt_end_time = profile.haltEndTime - pointee.high_limit_price = profile.highLimitPrice - pointee.low_limit_price = profile.lowLimitPrice - pointee.high_52_week_price = profile.high52WeekPrice - pointee.low_52_week_price = profile.low52WeekPrice - pointee.beta = profile.beta - pointee.earnings_per_share = profile.earningsPerShare - pointee.dividend_frequency = profile.dividendFrequency - pointee.ex_dividend_amount = profile.exDividendAmount - pointee.ex_dividend_day_id = profile.exDividendDayId - pointee.shares = profile.shares - pointee.free_float = profile.freeFloat - pointee.flags = profile.flags + pointer.pointee.description = profile.descriptionStr?.toCStringRef() + pointer.pointee.status_reason = profile.statusReason?.toCStringRef() + pointer.pointee.halt_start_time = profile.haltStartTime + pointer.pointee.halt_end_time = profile.haltEndTime + pointer.pointee.high_limit_price = profile.highLimitPrice + pointer.pointee.low_limit_price = profile.lowLimitPrice + pointer.pointee.high_52_week_price = profile.high52WeekPrice + pointer.pointee.low_52_week_price = profile.low52WeekPrice + pointer.pointee.beta = profile.beta + pointer.pointee.earnings_per_share = profile.earningsPerShare + pointer.pointee.dividend_frequency = profile.dividendFrequency + pointer.pointee.ex_dividend_amount = profile.exDividendAmount + pointer.pointee.ex_dividend_day_id = profile.exDividendDayId + pointer.pointee.shares = profile.shares + pointer.pointee.free_float = profile.freeFloat + pointer.pointee.flags = profile.flags let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_PROFILE return pointer diff --git a/DXFeedFramework/Native/Events/Markets/SeriesMapper.swift b/DXFeedFramework/Native/Events/Markets/SeriesMapper.swift index 547faf903..bdec7723b 100644 --- a/DXFeedFramework/Native/Events/Markets/SeriesMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/SeriesMapper.swift @@ -20,23 +20,22 @@ class SeriesMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.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 + pointer.pointee.index = series.index + pointer.pointee.event_flags = series.eventFlags + pointer.pointee.time_sequence = series.timeSequence + pointer.pointee.expiration = series.expiration + pointer.pointee.volatility = series.volatility + pointer.pointee.call_volume = series.callVolume + pointer.pointee.put_volume = series.putVolume + pointer.pointee.put_call_ratio = series.putCallRatio + pointer.pointee.forward_price = series.forwardPrice + pointer.pointee.dividend = series.dividend + pointer.pointee.interest = series.interest let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_SERIES diff --git a/DXFeedFramework/Native/Events/Markets/SpreadOrderMapper.swift b/DXFeedFramework/Native/Events/Markets/SpreadOrderMapper.swift index 9beaa91e0..cd513f5e8 100644 --- a/DXFeedFramework/Native/Events/Markets/SpreadOrderMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/SpreadOrderMapper.swift @@ -20,30 +20,29 @@ class SpreadOrderMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.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 + pointer.pointee.order_base.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.order_base.market_event.event_time = event.eventTime let order = event.spreadOrder - 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.spread_symbol = order.spreadSymbol?.toCStringRef() + pointer.pointee.order_base.market_event.event_time = order.eventTime + pointer.pointee.order_base.event_flags = order.eventFlags + pointer.pointee.order_base.index = order.index + pointer.pointee.order_base.time_sequence = order.timeSequence + pointer.pointee.order_base.time_nano_part = order.timeNanoPart + pointer.pointee.order_base.action_time = order.actionTime + pointer.pointee.order_base.order_id = order.orderId + pointer.pointee.order_base.aux_order_id = order.auxOrderId + pointer.pointee.order_base.price = order.price + pointer.pointee.order_base.size = order.size + pointer.pointee.order_base.executed_size = order.executedSize + pointer.pointee.order_base.count = order.count + pointer.pointee.order_base.flags = order.flags + pointer.pointee.order_base.trade_id = order.tradeId + pointer.pointee.order_base.trade_price = order.tradePrice + pointer.pointee.order_base.trade_size = order.tradeSize + + pointer.pointee.spread_symbol = order.spreadSymbol?.toCStringRef() let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_SPREAD_ORDER diff --git a/DXFeedFramework/Native/Events/Markets/SummaryMapper.swift b/DXFeedFramework/Native/Events/Markets/SummaryMapper.swift index 27e7709b4..5dabc2b4b 100644 --- a/DXFeedFramework/Native/Events/Markets/SummaryMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/SummaryMapper.swift @@ -20,21 +20,20 @@ class SummaryMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let summary = event.summary - pointee.day_id = summary.dayId - pointee.day_open_price = summary.dayOpenPrice - pointee.day_high_price = summary.dayHighPrice - pointee.day_low_price = summary.dayLowPrice - pointee.day_close_price = summary.dayClosePrice - pointee.prev_day_id = summary.prevDayId - pointee.prev_day_close_price = summary.prevDayClosePrice - pointee.prev_day_volume = summary.prevDayVolume - pointee.open_interest = summary.openInterest - pointee.flags = summary.flags + pointer.pointee.day_id = summary.dayId + pointer.pointee.day_open_price = summary.dayOpenPrice + pointer.pointee.day_high_price = summary.dayHighPrice + pointer.pointee.day_low_price = summary.dayLowPrice + pointer.pointee.day_close_price = summary.dayClosePrice + pointer.pointee.prev_day_id = summary.prevDayId + pointer.pointee.prev_day_close_price = summary.prevDayClosePrice + pointer.pointee.prev_day_volume = summary.prevDayVolume + pointer.pointee.open_interest = summary.openInterest + pointer.pointee.flags = summary.flags let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_SUMMARY diff --git a/DXFeedFramework/Native/Events/Markets/TheoPriceMapper.swift b/DXFeedFramework/Native/Events/Markets/TheoPriceMapper.swift index d6aa29d07..639c10ac2 100644 --- a/DXFeedFramework/Native/Events/Markets/TheoPriceMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/TheoPriceMapper.swift @@ -20,20 +20,19 @@ class TheoPriceMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let theoPrice = event.theoPrice - pointee.event_flags = theoPrice.eventFlags - pointee.index = theoPrice.index - pointee.price = theoPrice.price - pointee.underlying_price = theoPrice.underlyingPrice - pointee.delta = theoPrice.delta - pointee.gamma = theoPrice.gamma - pointee.dividend = theoPrice.dividend - pointee.interest = theoPrice.interest + pointer.pointee.event_flags = theoPrice.eventFlags + pointer.pointee.index = theoPrice.index + pointer.pointee.price = theoPrice.price + pointer.pointee.underlying_price = theoPrice.underlyingPrice + pointer.pointee.delta = theoPrice.delta + pointer.pointee.gamma = theoPrice.gamma + pointer.pointee.dividend = theoPrice.dividend + pointer.pointee.interest = theoPrice.interest let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_THEO_PRICE diff --git a/DXFeedFramework/Native/Events/Markets/TimeAndSaleMapper.swift b/DXFeedFramework/Native/Events/Markets/TimeAndSaleMapper.swift index fd24c5d88..f29ede032 100644 --- a/DXFeedFramework/Native/Events/Markets/TimeAndSaleMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/TimeAndSaleMapper.swift @@ -20,23 +20,22 @@ class TimeAndSaleMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let timeAndSale = event.timeAndSale - pointee.event_flags = timeAndSale.eventFlags - pointee.index = timeAndSale.index - pointee.time_nano_part = timeAndSale.timeNanoPart - pointee.exchange_code = timeAndSale.exchangeCode - pointee.price = timeAndSale.price - pointee.size = timeAndSale.size - pointee.bid_price = timeAndSale.bidPrice - pointee.ask_price = timeAndSale.askPrice - pointee.exchange_sale_conditions = timeAndSale.exchangeSaleConditions?.toCStringRef() - pointee.flags = timeAndSale.flags - pointee.buyer = timeAndSale.buyer?.toCStringRef() - pointee.seller = timeAndSale.seller?.toCStringRef() + pointer.pointee.event_flags = timeAndSale.eventFlags + pointer.pointee.index = timeAndSale.index + pointer.pointee.time_nano_part = timeAndSale.timeNanoPart + pointer.pointee.exchange_code = timeAndSale.exchangeCode + pointer.pointee.price = timeAndSale.price + pointer.pointee.size = timeAndSale.size + pointer.pointee.bid_price = timeAndSale.bidPrice + pointer.pointee.ask_price = timeAndSale.askPrice + pointer.pointee.exchange_sale_conditions = timeAndSale.exchangeSaleConditions?.toCStringRef() + pointer.pointee.flags = timeAndSale.flags + pointer.pointee.buyer = timeAndSale.buyer?.toCStringRef() + pointer.pointee.seller = timeAndSale.seller?.toCStringRef() let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_TIME_AND_SALE return pointer diff --git a/DXFeedFramework/Native/Events/Markets/TradeMapper.swift b/DXFeedFramework/Native/Events/Markets/TradeMapper.swift index 58980388b..74020ed14 100644 --- a/DXFeedFramework/Native/Events/Markets/TradeMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/TradeMapper.swift @@ -20,21 +20,20 @@ class TradeMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let trade = event.trade - pointee.time_sequence = trade.timeSequence - pointee.time_nano_part = trade.timeNanoPart - pointee.exchange_code = trade.exchangeCode - pointee.price = trade.price - pointee.change = trade.change - pointee.size = trade.size - pointee.day_id = trade.dayId - pointee.day_volume = trade.dayVolume - pointee.day_turnover = trade.dayTurnover - pointee.flags = trade.flags + pointer.pointee.time_sequence = trade.timeSequence + pointer.pointee.time_nano_part = trade.timeNanoPart + pointer.pointee.exchange_code = trade.exchangeCode + pointer.pointee.price = trade.price + pointer.pointee.change = trade.change + pointer.pointee.size = trade.size + pointer.pointee.day_id = trade.dayId + pointer.pointee.day_volume = trade.dayVolume + pointer.pointee.day_turnover = trade.dayTurnover + pointer.pointee.flags = trade.flags let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_TRADE diff --git a/DXFeedFramework/Native/Events/Markets/UnderlyingMapper.swift b/DXFeedFramework/Native/Events/Markets/UnderlyingMapper.swift index 00046e4ce..cf851f238 100644 --- a/DXFeedFramework/Native/Events/Markets/UnderlyingMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/UnderlyingMapper.swift @@ -20,20 +20,19 @@ class UnderlyingMapper: Mapper { func toNative(event: MarketEvent) -> UnsafeMutablePointer? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) - var pointee = pointer.pointee - pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() - pointee.market_event.event_time = event.eventTime + pointer.pointee.market_event.event_symbol = event.eventSymbol.toCStringRef() + pointer.pointee.market_event.event_time = event.eventTime let underlying = event.underlying - pointee.event_flags = underlying.eventFlags - pointee.index = underlying.index - pointee.volatility = underlying.volatility - pointee.front_volatility = underlying.frontVolatility - pointee.back_volatility = underlying.backVolatility - pointee.call_volume = underlying.callVolume - pointee.put_volume = underlying.putVolume - pointee.put_call_ratio = underlying.putCallRatio + pointer.pointee.event_flags = underlying.eventFlags + pointer.pointee.index = underlying.index + pointer.pointee.volatility = underlying.volatility + pointer.pointee.front_volatility = underlying.frontVolatility + pointer.pointee.back_volatility = underlying.backVolatility + pointer.pointee.call_volume = underlying.callVolume + pointer.pointee.put_volume = underlying.putVolume + pointer.pointee.put_call_ratio = underlying.putCallRatio let eventType = pointer.withMemoryRebound(to: dxfg_event_type_t.self, capacity: 1) { pointer in pointer.pointee.clazz = DXFG_EVENT_UNDERLYING diff --git a/DXFeedFramework/Native/Feed/NativePublisher.swift b/DXFeedFramework/Native/Feed/NativePublisher.swift index 6b2f68f4d..5fc71db1d 100644 --- a/DXFeedFramework/Native/Feed/NativePublisher.swift +++ b/DXFeedFramework/Native/Feed/NativePublisher.swift @@ -39,9 +39,8 @@ class NativePublisher { nativeEvents.forEach { mapper.releaseNative(native: $0) } } let thread = currentThread() - let result = try ErrorCheck.nativeCall(thread, dxfg_DXPublisher_publishEvents(thread, + _ = try ErrorCheck.nativeCall(thread, dxfg_DXPublisher_publishEvents(thread, publisher, listPointer)) - print(result) } } diff --git a/Samples/PerfTestCL/DumpCommand.swift b/Samples/PerfTestCL/DumpCommand.swift new file mode 100644 index 000000000..434525c43 --- /dev/null +++ b/Samples/PerfTestCL/DumpCommand.swift @@ -0,0 +1,110 @@ +// +// DumpCommand.swift +// Tools +// +// Created by Aleksey Kosylo on 19.10.23. +// + +import Foundation +import DXFeedFramework + +class DumpCommand: ToolsCommand { + var cmd: String = "Dump" + + var shortDescription = "Dumps all events received from address." + + var fullDescription = + """ + Dumps all events received from address. + Enforces a streaming contract for subscription. A wildcard enabled by default. + This was designed to receive data from a file. + Usage: Dump
[] + + Where: +
is a URL to Schedule API defaults file + is comma-separated list of dxfeed event types ({eventTypeNames}). + is comma-separated list of symbol names to get events for (e.g. ""IBM,AAPL,MSFT""). + for Candle event specify symbol with aggregation like in ""AAPL{{=d}}"" + + sample: Dump demo.dxfeed.com:7300 quote AAPL,IBM,ETH/USD:GDAX -t "tape_test.txt[format=text]" + """ + var publisher: DXPublisher? + + func execute() { + var arguments: [String]! + do { + arguments = try ArgumentParser().parse(ProcessInfo.processInfo.arguments, requiredNumberOfArguments: 4) + } catch { + print(fullDescription) + } + let address = arguments[1] + let types = arguments[2] + let symbols = arguments[3].components(separatedBy: ",") + + var tapeFile = "" + if arguments.count > 4 { + if arguments[4] == "-t" { + tapeFile = arguments[5] + } + } + do { + let inputEndpoint = try DXEndpoint + .builder() + .withRole(.streamFeed) + .withProperty(DXEndpoint.Property.wildcardEnable.rawValue, "true") + .withName("DumpTool") + .build() + + let eventTypes = types.split(separator: ",").compactMap { str in + return EventCode(string: String(str)) + } + let subscription = try inputEndpoint.getFeed()?.createSubscription(eventTypes) + + let outputEndpoint = try DXEndpoint + .builder() + .withRole(.publisher) + .withProperty(DXEndpoint.Property.wildcardEnable.rawValue, "true") + .withName("DumpTool") + .build() + print("tape:\(tapeFile)") + try outputEndpoint.connect("tape:\(tapeFile)") + + publisher = outputEndpoint.getPublisher() + try subscription?.add(observer: self) + + try subscription?.addSymbols(symbols) + + try inputEndpoint.connect(address) + + try inputEndpoint.awaitNotConnected() + try inputEndpoint.closeAndAWaitTermination() + + try outputEndpoint.awaitNotConnected() + try outputEndpoint.closeAndAWaitTermination() + } catch { + print("Dump tool error: \(error)") + } + // Print till input new line + } +} + +extension DumpCommand: Hashable { + static func == (lhs: DumpCommand, rhs: DumpCommand) -> Bool { + return lhs === rhs + } + + func hash(into hasher: inout Hasher) { + hasher.combine(stringReference(self)) + } +} + +extension DumpCommand: DXEventListener { + func receiveEvents(_ events: [DXFeedFramework.MarketEvent]) { + do { + print(events) + try publisher?.publish(events: events) + } catch { + print("Dump tool publish error: \(error)") + } + } +} diff --git a/Samples/PerfTestCL/main.swift b/Samples/PerfTestCL/main.swift index 287d1288e..32b682889 100644 --- a/Samples/PerfTestCL/main.swift +++ b/Samples/PerfTestCL/main.swift @@ -13,6 +13,7 @@ let commands: [ToolsCommand] = [PerfTestCommand(), LiveIpfCommand(), ScheduleCommand(), IpfConnectCommand(), + DumpCommand(), HelpCommand()] func getCommand(_ cmd: String) -> ToolsCommand? {