Open inethak opened 1 month ago
if _method == '1': ## FOR METHOD 1
upg_sort = sorted(
[u for u in upgrades if u['price'] <= max_price],
key=lambda x: -x['profitPerHour']
)
elif _method == '2': ## FOR METHOD 2
upg_sort = sorted(
[u for u in upgrades if u['price'] <= max_price],
key=lambda x: x['price']
)
elif _method == '3': ## FOR METHOD 3
upg_sort = [u for u in upgrades if u['price'] <= balance_coins and u['price'] <= max_price]
Which one ? can you create a ratio in lambda for me ?
lambda is:
lambda x : -x['profitPerHour']/x['price']
and sorted([ ...upgrades], key=lambda...)
will return a list from best to poor for purchase by ratio. (max 'profitPerHour' for minal 'price')
I didn't dig deep enough to write the entire if method == 4
I can’t formulate all the conditions. accounting temporal special upgrades seems like 5 strategy
oops, I was mistaken. 'profitPerHour' - Is this an increase upon purchase or a total increase for an upgrade? for profit/price ratio need increase when purchasing an upgrade. I don’t know which key in upgrade contains the value
I added a new method into my instance:
upg_sort = sorted(
[u for u in upgrades if u['price'] > 0 and u['profitPerHourDelta'] > 0 and u['price'] <= max_price],
key=lambda x: x['price'] / x['profitPerHourDelta']
)
It sorts the list of upgrades in order of increasing price per passive income which upgrade will add. Tested it for a few days, looks quite effective. Example:
+---------------------+---------+---------+-------------+
| Upgrade | Level | Price | Income |
+---------------------+---------+---------+-------------+
| Licence Philippines | 10 | 2090804 | +11950 | 174.96
| Licence Nigeria | 12 | 64220 | +358 | 179.38
| Derivatives | 13 | 201826 | +1115 | 181.00
| | | | +13423 |
+---------------------+---------+---------+-------------+
I saw in the code a strategy for purchasing an upgrade at the lowest price and highest profit. it is not profitable. But how about calculating profit as ratio profit/price, to find the cheapest ratio coin/hour for upgrade? You should also give higher priority to temporary cards. This strategy will allow you to accumulate ratio coin/hour faster with low earnings. (like hamsters with a small number of referrals)