-
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.
next/prev day, next/prev session
- Loading branch information
Showing
13 changed files
with
495 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// DayFilter+Ext.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 18.09.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
extension DayFilter { | ||
init(value: dxfg_day_filter_prepare_t) { | ||
switch value { | ||
case DXFG_DAY_FILTER_ANY: | ||
self = .any | ||
case DXFG_DAY_FILTER_TRADING: | ||
self = .trading | ||
case DXFG_DAY_FILTER_NON_TRADING: | ||
self = .nonTrading | ||
case DXFG_DAY_FILTER_HOLIDAY: | ||
self = .holiday | ||
case DXFG_DAY_FILTER_SHORT_DAY: | ||
self = .shortDay | ||
case DXFG_DAY_FILTER_MONDAY: | ||
self = .monday | ||
case DXFG_DAY_FILTER_TUESDAY: | ||
self = .tuesday | ||
case DXFG_DAY_FILTER_WEDNESDAY: | ||
self = .wednesday | ||
case DXFG_DAY_FILTER_THURSDAY: | ||
self = .thursday | ||
case DXFG_DAY_FILTER_FRIDAY: | ||
self = .friday | ||
case DXFG_DAY_FILTER_SATURDAY: | ||
self = .saturday | ||
case DXFG_DAY_FILTER_SUNDAY: | ||
self = .sunday | ||
case DXFG_DAY_FILTER_WEEK_DAY: | ||
self = .weekDay | ||
case DXFG_DAY_FILTER_WEEK_END: | ||
self = .weekEnd | ||
default: | ||
fatalError("Wrong qd-value \(value) for DayFilter") | ||
} | ||
} | ||
|
||
func toQDValue() -> dxfg_day_filter_prepare_t { | ||
switch self { | ||
case .any: | ||
return DXFG_DAY_FILTER_ANY | ||
case .trading: | ||
return DXFG_DAY_FILTER_TRADING | ||
case .nonTrading: | ||
return DXFG_DAY_FILTER_NON_TRADING | ||
case .holiday: | ||
return DXFG_DAY_FILTER_HOLIDAY | ||
case .shortDay: | ||
return DXFG_DAY_FILTER_SHORT_DAY | ||
case .monday: | ||
return DXFG_DAY_FILTER_MONDAY | ||
case .tuesday: | ||
return DXFG_DAY_FILTER_TUESDAY | ||
case .wednesday: | ||
return DXFG_DAY_FILTER_WEDNESDAY | ||
case .thursday: | ||
return DXFG_DAY_FILTER_THURSDAY | ||
case .friday: | ||
return DXFG_DAY_FILTER_FRIDAY | ||
case .saturday: | ||
return DXFG_DAY_FILTER_SATURDAY | ||
case .sunday: | ||
return DXFG_DAY_FILTER_SUNDAY | ||
case .weekDay: | ||
return DXFG_DAY_FILTER_WEEK_DAY | ||
case .weekEnd: | ||
return DXFG_DAY_FILTER_WEEK_END | ||
} | ||
} | ||
} |
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,23 @@ | ||
// | ||
// NativeDay.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 18.09.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class NativeDay { | ||
let native: UnsafeMutablePointer<dxfg_day_t> | ||
|
||
init(native: UnsafeMutablePointer<dxfg_day_t>) { | ||
self.native = native | ||
} | ||
|
||
deinit { | ||
let thread = currentThread() | ||
_ = try? ErrorCheck.nativeCall(thread, dxfg_JavaObjectHandler_release(thread, &(native.pointee.handler))) | ||
} | ||
|
||
} |
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,22 @@ | ||
// | ||
// NativeSession.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 18.09.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class NativeSession { | ||
let native: UnsafeMutablePointer<dxfg_session_t> | ||
|
||
init(native: UnsafeMutablePointer<dxfg_session_t>) { | ||
self.native = native | ||
} | ||
|
||
deinit { | ||
let thread = currentThread() | ||
_ = try? ErrorCheck.nativeCall(thread, dxfg_JavaObjectHandler_release(thread, &(native.pointee.handler))) | ||
} | ||
} |
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,51 @@ | ||
// | ||
// SessionFilter+Ext.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 18.09.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
extension SessionFilter { | ||
init(value: dxfg_session_filter_prepare_t) { | ||
switch value { | ||
case DXFG_SESSION_FILTER_ANY: | ||
self = .any | ||
case DXFG_SESSION_FILTER_TRADING: | ||
self = .trading | ||
case DXFG_SESSION_FILTER_NON_TRADING: | ||
self = .nonTrading | ||
case DXFG_SESSION_FILTER_NO_TRADING: | ||
self = .noTrading | ||
case DXFG_SESSION_FILTER_PRE_MARKET: | ||
self = .preMarket | ||
case DXFG_SESSION_FILTER_REGULAR: | ||
self = .regular | ||
case DXFG_SESSION_FILTER_AFTER_MARKET: | ||
self = .afterMarket | ||
default: | ||
fatalError("Wrong qd-value \(value) for DayFilter") | ||
} | ||
} | ||
|
||
func toQDValue() -> dxfg_session_filter_prepare_t { | ||
switch self { | ||
case .any: | ||
return DXFG_SESSION_FILTER_ANY | ||
case .trading: | ||
return DXFG_SESSION_FILTER_TRADING | ||
case .nonTrading: | ||
return DXFG_SESSION_FILTER_NON_TRADING | ||
case .noTrading: | ||
return DXFG_SESSION_FILTER_NO_TRADING | ||
case .preMarket: | ||
return DXFG_SESSION_FILTER_PRE_MARKET | ||
case .regular: | ||
return DXFG_SESSION_FILTER_REGULAR | ||
case .afterMarket: | ||
return DXFG_SESSION_FILTER_AFTER_MARKET | ||
} | ||
} | ||
} |
Oops, something went wrong.