-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapply_workflow.py
64 lines (48 loc) · 1.66 KB
/
apply_workflow.py
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
62
63
64
from steampy.client import SteamClient
from src.data_utils import (
APPIDS_FNAME,
APPIDS_TO_SKIP_FNAME,
FOIL_CARDS_FNAME,
SECRETS_FNAME,
)
from src.json_utils import load_json, load_json_as_list
from src.order_utils import cancel_buy_orders, set_buy_orders
from src.print_utils import show_low_quantity_buy_orders
from src.utils import clean_price_to_appids, get_appid_to_cards, get_target_appids
def main() -> None:
secrets = load_json(SECRETS_FNAME)
steam_client = SteamClient(secrets["api_key"])
steam_client.login(secrets["username"], secrets["password"], secrets["steam_guard"])
# Reference: https://github.com/bukson/steampy#market-methods
listings = steam_client.market.get_my_market_listings()
show_low_quantity_buy_orders(listings, quantity_threshold=3)
## Clean dictionary
price_to_appids = load_json(APPIDS_FNAME)
price_to_appids_to_skip = load_json(APPIDS_TO_SKIP_FNAME)
price_to_appids = clean_price_to_appids(price_to_appids, price_to_appids_to_skip)
## Cancel buy orders
cancel_buy_orders(
steam_client,
listings,
price_of_interest="0,11€",
names_to_keep=(
"Cheeki Breeki",
"Cop",
"Nagibator",
"Survivalist",
"Zombie",
),
)
## Set buy orders
foil_cards = load_json_as_list(FOIL_CARDS_FNAME)
target_appids = get_target_appids(price_to_appids)
appid_to_cards = get_appid_to_cards(foil_cards, target_appids)
set_buy_orders(
steam_client,
listings,
price_to_appids,
appid_to_cards,
quantity=100,
)
if __name__ == "__main__":
main()