Update KrxRequest format
This commit is contained in:
@@ -19,7 +19,7 @@ protocol KrxRequest: Request {
|
||||
|
||||
extension KrxRequest {
|
||||
|
||||
public var queryType: QueryType { .json }
|
||||
public var queryType: QueryType { .urlEncoded }
|
||||
public var domain: String {
|
||||
"http://data.krx.co.kr"
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ extension DomesticExtra {
|
||||
case moneyBillion = 4
|
||||
}
|
||||
|
||||
/// 한국거래소 - 주가지수 - 전체지수 시세
|
||||
/// 한국거래소 - 기본통계 - 지수 - 주가지수 - 전체지수 시세
|
||||
///
|
||||
public struct IndexPriceRequest: KrxRequest {
|
||||
public typealias KResult = IndexPriceResult
|
||||
@@ -47,10 +47,13 @@ extension DomesticExtra {
|
||||
public var url: String {
|
||||
"/comm/bldAttendant/getJsonData.cmd"
|
||||
}
|
||||
public var method: Method { .get }
|
||||
public var method: Method { .post }
|
||||
|
||||
public var header: [String : String?] {
|
||||
[:]
|
||||
[
|
||||
"Referer": "http://data.krx.co.kr/contents/MDC/MDI/mdiLoader/index.cmd?menuId=MDC0203",
|
||||
"Origin": "http://data.krx.co.kr",
|
||||
]
|
||||
}
|
||||
public var body: [String: Any] {
|
||||
return [
|
||||
@@ -78,7 +81,7 @@ extension DomesticExtra {
|
||||
}
|
||||
|
||||
|
||||
/// 한국거래소 - 주가지수 - 지수구성종목
|
||||
/// 한국거래소 - 지수 - 주가지수 - 지수구성종목
|
||||
///
|
||||
public struct IndexPortfolioRequest: KrxRequest {
|
||||
public typealias KResult = IndexPortfolioResult
|
||||
@@ -86,10 +89,13 @@ extension DomesticExtra {
|
||||
public var url: String {
|
||||
"/comm/bldAttendant/getJsonData.cmd"
|
||||
}
|
||||
public var method: Method { .get }
|
||||
public var method: Method { .post }
|
||||
|
||||
public var header: [String : String?] {
|
||||
[:]
|
||||
[
|
||||
"Referer": "http://data.krx.co.kr/contents/MDC/MDI/mdiLoader/index.cmd?menuId=MDC0203",
|
||||
"Origin": "http://data.krx.co.kr",
|
||||
]
|
||||
}
|
||||
|
||||
public var body: [String: Any] {
|
||||
@@ -126,10 +132,13 @@ extension DomesticExtra {
|
||||
public var url: String {
|
||||
"/comm/bldAttendant/getJsonData.cmd"
|
||||
}
|
||||
public var method: Method { .get }
|
||||
public var method: Method { .post }
|
||||
|
||||
public var header: [String : String?] {
|
||||
[:]
|
||||
[
|
||||
"Referer": "http://data.krx.co.kr/contents/MDC/MDI/mdiLoader/index.cmd?menuId=MDC0203",
|
||||
"Origin": "http://data.krx.co.kr",
|
||||
]
|
||||
}
|
||||
public var body: [String: Any] {
|
||||
return [
|
||||
|
||||
@@ -10,7 +10,7 @@ import Foundation
|
||||
|
||||
extension DomesticExtra {
|
||||
|
||||
/// 한국거래소 - 공매도 통계 - 잔고현황
|
||||
/// 한국거래소 - 공매도 통계 - 공매도 순보유잔고 - [33001] 개별종목 공매도 순보유잔고
|
||||
///
|
||||
public struct ShortSellingBalanceRequest: KrxRequest {
|
||||
public typealias KResult = ShortSellingBalanceResult
|
||||
@@ -18,10 +18,13 @@ extension DomesticExtra {
|
||||
public var url: String {
|
||||
"/comm/bldAttendant/getJsonData.cmd"
|
||||
}
|
||||
public var method: Method { .get }
|
||||
public var method: Method { .post }
|
||||
|
||||
public var header: [String : String?] {
|
||||
[:]
|
||||
[
|
||||
"Referer": "http://data.krx.co.kr/contents/MDC/MDI/mdiLoader/index.cmd?menuId=MDC0203",
|
||||
"Origin": "http://data.krx.co.kr",
|
||||
]
|
||||
}
|
||||
public var body: [String: Any] {
|
||||
if let range = range {
|
||||
@@ -29,7 +32,10 @@ extension DomesticExtra {
|
||||
"isuCd": range.isinCode,
|
||||
"strtDd": range.startDate.yyyyMMdd,
|
||||
"endDd": range.endDate.yyyyMMdd,
|
||||
"bld": "dbms/MDC/STAT/srt/MDCSTAT30502"
|
||||
"bld": "dbms/MDC/STAT/srt/MDCSTAT30502",
|
||||
"searchType": 2,
|
||||
"share": shareType.rawValue,
|
||||
"money": moneyType.rawValue
|
||||
]
|
||||
}
|
||||
else {
|
||||
@@ -48,9 +54,13 @@ extension DomesticExtra {
|
||||
let endDate: Date // yyyyMMdd
|
||||
}
|
||||
let range: DataRange?
|
||||
let shareType: ShareType
|
||||
let moneyType: MoneyType
|
||||
|
||||
init(range: DataRange?) {
|
||||
self.range = range
|
||||
self.shareType = .unitOne
|
||||
self.moneyType = .moneyWon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ extension Domestic {
|
||||
public let message: String
|
||||
public let straightInqueryCondition: String?
|
||||
public let straightInqueryKey: String?
|
||||
public let output1: [OutputStock]
|
||||
public let output2: [OutputAmount]
|
||||
public let output1: [OutputStock]?
|
||||
public let output2: [OutputAmount]?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case resultCode = "rt_cd"
|
||||
|
||||
@@ -1179,8 +1179,8 @@ extension KissConsole {
|
||||
var symbols = Set<String>()
|
||||
|
||||
symbols.formUnion(DomesticShop.ProductResponse.Item.symbols())
|
||||
symbols.formUnion(BalanceResult.OutputStock.symbols())
|
||||
symbols.formUnion(BalanceResult.OutputAmount.symbols())
|
||||
symbols.formUnion(Domestic.BalanceResult.OutputStock.symbols())
|
||||
symbols.formUnion(Domestic.BalanceResult.OutputAmount.symbols())
|
||||
symbols.formUnion(MinutePriceResult.OutputPrice.symbols())
|
||||
symbols.formUnion(PeriodPriceResult.OutputPrice.symbols())
|
||||
symbols.formUnion(VolumeRankResult.OutputDetail.symbols())
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
//KissConsole().run()
|
||||
KissConsole().run()
|
||||
|
||||
import KissMe
|
||||
|
||||
@@ -16,4 +16,4 @@ import KissMe
|
||||
//test_parse_contact_price_response()
|
||||
//test_websocket_dump_data()
|
||||
|
||||
test_auction()
|
||||
//test_auction()
|
||||
|
||||
Reference in New Issue
Block a user