Scanners
First, you need login.¶
Scanners can use parameter of scannertype to get the rank of ChangePercent, ChangePrice, DayRange, Volume and Amount.
In
api.scanners?
Out
Signature:
api.scanners(
scanner_type: shioaji.constant.ScannerType,
ascending: bool = True,
date: str = None,
count: shioaji.shioaji.ConstrainedIntValue = 100,
timeout: int = 30000,
cb: Callable[[List[shioaji.data.ChangePercentRank]], NoneType] = None,
)
Attributes:
scanner_type (ScannerType):
{ChangePercentRank, ChangePriceRank, DayRangeRank, VolumeRank, AmountRank}
ascending (bool): ascending
date (str): date
count (int): count {1<=count<=200}
Get Amount Rank¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.AmountRank,
count = 1
)
scanner[0]
Out
ChangePercentRank(
date='2021-04-09',
code='2603',
name='長榮',
ts=1617978600000000000,
open=52.5,
high=52.7,
low=49.0,
close=50.0,
price_range=3.7,
tick_type=2,
change_price=-2.3,
change_type=4,
average_price=50.52,
volume=817,
total_volume=387811,
amount=40850000,
total_amount=19593829300,
yesterday_volume=275461,
volume_ratio=1.41,
buy_price=50.0,
buy_volume=3039,
sell_price=50.1,
sell_volume=631,
bid_orders=22299,
bid_volumes=10620,
ask_orders=22648,
ask_volumes=12709
)
To DataFrame¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.AmountRank,
count = 5
)
scanner_df = pd.DataFrame(scanner)
scanner_df.ts = pd.to_datetime(scanner_df.ts)
scanner_df
Out
amount | ask_orders | ask_volumes | average_price | bid_orders | bid_volumes | buy_price | ... | tick_type | total_amount | total_volume | ts | volume | volume_ratio | yesterday_volume | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 481150000 | 22646 | 12709 | 50.53 | 22299 | 10620 | 50.00 | ... | 2 | 19551063400 | 386956 | 2021-04-09 13:30:00 | 9623 | 1.40 | 275461 |
1 | 59170000 | 4361 | 3256 | 612.46 | 3316 | 2225 | 610.00 | ... | 1 | 16633534000 | 27159 | 2021-04-09 13:30:00 | 3371 | 1.13 | 23976 |
2 | 31724550 | 23002 | 12669 | 25.00 | 31294 | 11268 | 24.60 | ... | 2 | 16590525150 | 663561 | 2021-04-09 13:30:00 | 14888 | 1.55 | 427521 |
3 | 5968200 | 20378 | 13430 | 33.02 | 28132 | 12023 | 34.30 | ... | 1 | 15120385700 | 457881 | 2021-04-09 13:30:00 | 870 | 4.44 | 103173 |
4 | 54225000 | 9596 | 7394 | 235.00 | 10634 | 7349 | 225.00 | ... | 1 | 14149030500 | 60199 | 2021-04-09 13:30:00 | 1056 | 1.60 | 37622 |
Get Change PriceRank¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.ChangePriceRank,
count = 1
)
scanner[0]
Out
ChangePercentRank(
date='2021-04-09', code='6781',
name='AES-KY',
ts=1617978600000000000,
open=660.0,
high=698.0,
low=634.0,
close=698.0,
price_range=64.0,
tick_type=1,
change_price=63.0,
change_type=1,
average_price=667.63,
volume=1,
total_volume=1902,
amount=698000,
total_amount=1269849148,
yesterday_volume=1098,
volume_ratio=1.73,
buy_price=698.0,
buy_volume=1264,
sell_price=0.0,
sell_volume=0,
bid_orders=717,
bid_volumes=398,
ask_orders=296,
ask_volumes=288
)
Get Volume Rank¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.VolumeRank,
count = 1
)
scanner[0]
Out
ChangePercentRank(
date='2021-04-09',
code='3481',
name='群創',
ts=1617978600000000000,
open=24.45,
high=25.9,
low=24.3,
close=24.65,
price_range=1.6,
tick_type=1,
change_price=0.65,
change_type=2,
average_price=25.0,
volume=1287,
total_volume=664906,
amount=31724550,
total_amount=16623686424,
yesterday_volume=427521,
volume_ratio=1.56,
buy_price=24.6,
buy_volume=3528,
sell_price=24.65,
sell_volume=491,
bid_orders=31294,
bid_volumes=11268,
ask_orders=23002,
ask_volumes=12669
)
Get Change Percent Rank¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.ChangePercentRank,
count = 1
)
scanner[0]
Out
ChangePercentRank(
date='2021-04-09',
code='5211',
name='蒙恬',
ts=1617978600000000000,
open=16.4,
high=17.6,
low=16.35,
close=17.6,
price_range=1.25,
tick_type=1,
change_price=1.6,
change_type=1,
average_price=17.45,
volume=7,
total_volume=1742,
amount=123200,
total_amount=30397496,
yesterday_volume=514,
volume_ratio=3.39,
buy_price=17.6,
buy_volume=723,
sell_price=0.0,
sell_volume=0,
bid_orders=237,
bid_volumes=82,
ask_orders=33,
ask_volumes=64
)
Get Day Range Rank¶
In
scanner = api.scanners(
scanner_type = sj.constant.ScannerType.DayRangeRank,
count=1
)
scanner[0]
Out
ChangePercentRank(
date='2021-04-09',
code='6415',
name='矽力-KY',
ts=1617978600000000000,
open=2560.0,
high=2620.0,
low=2455.0,
close=2525.0,
price_range=165.0,
tick_type=1,
change_price=-20.0,
change_type=4,
average_price=2506.18,
volume=3,
total_volume=711,
amount=7575000,
total_amount=1781892220,
yesterday_volume=669,
volume_ratio=1.06,
buy_price=2520.0,
buy_volume=13,
sell_price=2525.0,
sell_volume=1,
bid_orders=248,
bid_volumes=125,
ask_orders=189,
ask_volumes=162
)