Skip to content

Commit

Permalink
use huobi test env
Browse files Browse the repository at this point in the history
  • Loading branch information
wufeiafei committed May 3, 2018
1 parent 598d053 commit 30ab75b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "KWBTC/WSManager/BFWSManager.m"
timestampString = "546962763.6509711"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "119"
endingLineNumber = "119"
landmarkName = "-parseWithData:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "KWBTC/WSManager/BFWSManager.m"
timestampString = "546962763.651491"
timestampString = "547043007.872344"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "63"
Expand Down Expand Up @@ -74,12 +58,12 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "KWBTC/WSManager/BFWSManager.m"
timestampString = "546962763.651979"
timestampString = "547043007.872762"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "156"
endingLineNumber = "156"
landmarkName = "-websocketDidDisconnect:error:"
startingLineNumber = "185"
endingLineNumber = "185"
landmarkName = "-websocket:didReceiveMessage:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand Down
4 changes: 3 additions & 1 deletion KWBTC/Common/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
//#define wsURL @"wss://api.bitfinex.com/ws"
//火币
//#define wsURL @"wss://api.huobipro.com/ws"
#define wsURL @"wss://api.hadax.com/ws"
//#define wsURL @"wss://api.hadax.com/ws"
//h火币测试环境
#define wsURL @"wss://api.huobi.br.com/ws"



Expand Down
33 changes: 31 additions & 2 deletions KWBTC/WSManager/BFWSManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ -(void)disConnect
-(void)sendBTC
{

// NSDictionary *dic = @{
// @"event": @"subscribe",
// @"channel": @"ticker",
// @"symbol": @"tBTCUSD"
// };

// NSDictionary *dic = @{
// @"event": @"subscribe",
// @"channel": @"candles",
Expand All @@ -81,7 +87,8 @@ -(void)sendBTC
// };

NSDictionary *dic = @{
@"sub": @"market.ethbtc.kline.1min",

@"sub": @"market.btcusdt.kline.1min",
@"id": @"id1"
};

Expand Down Expand Up @@ -115,7 +122,23 @@ -(void)pongServerWithPongSting:(NSString*)pongString
#pragma mark -- parse
-(void)parseWithData:(id)data
{

if ([data isKindOfClass:[NSDictionary class]]&&data) {
NSDictionary *dic = data;

NSString *BTCPrice = dic[@"close"];
_btcPrice = BTCPrice;
if (_btcBlock) {
_btcBlock(BTCPrice);
}
}

}

/*
-(void)parseWithData:(id)data
{
if ([data isKindOfClass:[NSArray class]]&&data) {
NSArray *array = data;
Expand All @@ -139,6 +162,7 @@ -(void)parseWithData:(id)data
}
*/


#pragma mark -- delegate
Expand Down Expand Up @@ -192,8 +216,13 @@ -(void)websocket:(JFRWebSocket*)socket didReceiveData:(NSData*)data {
[self pongServerWithPongSting:dic[@"ping"]];

}

if (dic[@"tick"]) {

[self parseWithData:dic[@"tick"]];

}




}
Expand Down

0 comments on commit 30ab75b

Please sign in to comment.