-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGGTimeLineItem.m
More file actions
61 lines (51 loc) · 2.32 KB
/
Copy pathGGTimeLineItem.m
File metadata and controls
61 lines (51 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// GGTimeLineItem.m
// Taurus
//
// Created by 王刚 on 2018/12/11.
// Copyright © 2018年 LOVER. All rights reserved.
//
#import "GGTimeLineItem.h"
@implementation GGTimeLineItem
-(instancetype)initWithDict:(NSDictionary *)dict{
self = [super initWithDict:dict];
if (self) {
self.amount = [NSString stringWithFormat:@"%@",dict[@"amount"]];
self.AvgPirce = [NSString stringWithFormat:@"%@",dict[@"avgPrice"]];
self.change = [NSString stringWithFormat:@"%@",dict[@"change"]];
self.ClosePrice = [NSString stringWithFormat:@"%@",dict[@"close"]];
NSString * current = [NSString stringWithFormat:@"%@",dict[@"current"]];
float currentF = [current floatValue];
NSString * current0 = [NSString stringWithFormat:@"%.2f",currentF];
self.CurrentPrice = current0;
NSString * time = [NSString stringWithFormat:@"%@",dict[@"date"]];
NSArray * timeArr = [time componentsSeparatedByString:@" "];
NSString * time0 = timeArr[1];
NSArray * time0Arr = [time0 componentsSeparatedByString:@":"];
NSString * time1 = [[NSString alloc] init];
time1 = [NSString stringWithFormat:@"%@:%@",time0Arr[0],time0Arr[1]];
BOOL result = [time1 compare:@"11:30"] == NSOrderedDescending;
if (result) {
//下午开盘
int hh = [time0Arr[0] intValue];
int mm = [time0Arr[1] intValue];
int tt = hh*60+mm;
int t = 89;
int result = tt-t;
int second = (int)result%60;
int minute = (int)result/60;
time1 = [NSString stringWithFormat:@"%d:%d",minute,second];
// DbugLog(@"%@",time1);
}
self.CurrentTime = time1;
self.MaxPrice = [NSString stringWithFormat:@"%@",dict[@"high"]];
self.MinPrice = [NSString stringWithFormat:@"%@",dict[@"low"]];
self.percent = [NSString stringWithFormat:@"%@",dict[@"percent"]];
self.stockSymbol = [NSString stringWithFormat:@"%@",dict[@"stockSymbol"]];
self.DataTime_stamp = [NSString stringWithFormat:@"%@",dict[@"timestamp"]];
self.LastVolume_trade = [NSString stringWithFormat:@"%@",dict[@"volume"]];
self.Volume = [NSString stringWithFormat:@"%@",dict[@"volume"]];
}
return self;
}
@end