|
1
|
|
|
#!/usr/bin/python |
|
2
|
|
|
# -*- coding: utf-8 -*- |
|
3
|
|
|
|
|
4
|
|
|
from kuon.bitskins.api.interfaces import ISales |
|
5
|
|
|
from kuon.watcher.adapters import SalesAdapterBase |
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class SalesAdapter(SalesAdapterBase): |
|
9
|
|
|
"""Adapter for the Sales Interface of BitSkins""" |
|
10
|
|
|
|
|
11
|
|
|
def __init__(self, *args, **kwargs): |
|
12
|
|
|
"""Initializing function |
|
13
|
|
|
|
|
14
|
|
|
:param args: |
|
15
|
|
|
:param kwargs: |
|
16
|
|
|
""" |
|
17
|
|
|
self.sales_interface = ISales(*args, **kwargs) |
|
18
|
|
|
|
|
19
|
|
|
def search(self, market_name): |
|
20
|
|
|
"""Implementation of the search function |
|
21
|
|
|
|
|
22
|
|
|
:param market_name: |
|
23
|
|
|
:return: |
|
24
|
|
|
""" |
|
25
|
|
|
# ToDo: unify the units(BitSkins float like 5.50, OPSkins int like 550) |
|
26
|
|
|
return self.sales_interface.get_inventory_on_sale(market_hash_name=market_name) |
|
27
|
|
|
|
|
28
|
|
|
def search_no_delay(self, market_name): |
|
29
|
|
|
"""Implementation of the search no delay function |
|
30
|
|
|
|
|
31
|
|
|
:param market_name: |
|
32
|
|
|
:return: |
|
33
|
|
|
""" |
|
34
|
|
|
# ToDo: unify the units(BitSkins float like 5.50, OPSkins int like 550) |
|
35
|
|
|
return self.sales_interface.get_inventory_on_sale(market_hash_name=market_name) |
|
36
|
|
|
|
|
37
|
|
|
def get_sold_history(self, market_name): |
|
38
|
|
|
"""Implementation of get sold history function |
|
39
|
|
|
|
|
40
|
|
|
:param market_name: |
|
41
|
|
|
:return: |
|
42
|
|
|
""" |
|
43
|
|
|
# ToDo: use search function to get the full market hash name(partial not allowed here) |
|
44
|
|
|
return self.sales_interface.get_sales_info(market_hash_name=market_name) |
|
45
|
|
|
|
|
46
|
|
|
def get_sold_history_no_delay(self, market_name): |
|
47
|
|
|
"""Implementation of get sold history no delay function |
|
48
|
|
|
|
|
49
|
|
|
:param market_name: |
|
50
|
|
|
:return: |
|
51
|
|
|
""" |
|
52
|
|
|
# ToDo: use search function to get the full market hash name(partial not allowed here) |
|
53
|
|
|
return self.sales_interface.get_sales_info(market_hash_name=market_name) |
|
54
|
|
|
|