jawikas / hamsterkombat

This is a bot that can help you to run hamsterkombat telegram bot which has quite complete features with auto upgrade (3 methods), auto complete combo & auto complete daily cipher/morse.
https://t.me/hamster_kombat_Bot/start?startapp=kentId1323733375
71 stars 25 forks source link

profit/price ratio based profit strategy #9

Open inethak opened 1 month ago

inethak commented 1 month ago

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)

jawikas commented 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 ?
inethak commented 1 month ago

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

inethak commented 1 month ago

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

k0f3st commented 1 month ago

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   |
+---------------------+---------+---------+-------------+