axel3rd / mpg-coach-bot

MPG (Mon Petit Gazon) coach bot, to automate and optimize weekly actions
https://axel3rd.github.io/mpg-coach-bot/
MIT License
21 stars 8 forks source link

Automatic mercato #226

Open axel3rd opened 2 years ago

axel3rd commented 2 years ago

With #139 support, an automatic mercato feature can be implemented.

Options to support (with default values):

# Amount by line (sum <= 500)
mercato.auto.amount.attackers = 200
mercato.auto.amount.midfielders = 150
mercato.auto.amount.defenders  =  100
mercato.auto.amount.goalkeepers = 50

# Number of players to buy by line (should respect minimal MPG values)
mercato.auto.number.attackers = 5
mercato.auto.number.midfielders = 6
mercato.auto.number.defenders  =  5
mercato.auto.number.goalkeepers = 2

# Maximum (in percent) of remaining amount for next player choice
# A value near 100 will provide 2 goods players and poor for the rest
mercato.auto.amount.remain.ratio = 50

# Coefficient to apply on auction players (see mpgstats website)
# Useful when your friends bet like Qataris
mercato.auto.auction.coeff.attackers = 1.0
mercato.auto.auction.coeff.midfielders = 1.0
mercato.auto.auction.coeff.defenders  =  1.0
mercato.auto.auction.coeff.goalkeepers = 1.0

# Keep any players pre-selected at turn 1
mercato.auto.keep.players = true
axel3rd commented 2 years ago

WARNING: When season start and no mercatos achieved in any leagues, no transactions done so auction = 0 for all players (The metric of last season/year is not used) => cannot be used for automatic process 😢.

axel3rd commented 2 years ago

WARNING: When season start and no mercatos achieved in any leagues, no transactions done so auction = 0 for all players (The metric of last season/year is not used) => cannot be used for automatic process 😢.

Could be now fixed by using "long auctions" concept (https://github.com/axel3rd/mpg-coach-bot/issues/232)

axel3rd commented 1 year ago

API info


Mercato infos

URL:

GET https://api.mpg.football/division/mpg_division_MLMHBPCB_5_1

Response: "mercatoState.nextMercatoTurn" (UTC !!!)

Team set name

URL:

POST (or PATCH?) https://api.mpg.football/division/mpg_division_MLMHBPCB_5_1/team

Request:

{"abbreviation":"AFC","gear":{"home":{"jerseyId":"mpg_jersey_0_1631281964754"}},"name":"Axel Football Club"}

Jersey info: URL:

GET https://api.mpg.football/locker-room/extended

Response: "lockerRoom.jerseys"

Mercato Bid

URL:

POST https://api.mpg.football/team/mpg_team_MLMHBPCB_5_1_3/mercato-bids

Request:

{"turn":1,"bids":[{"id":"mpg_championship_player_149065","price":29},{"id":"mpg_championship_player_17745","price":21},{"id":"mpg_championship_player_226597","price":26},{"id":"mpg_championship_player_94147","price":28},{"id":"mpg_championship_player_199796","price":23},{"id":"mpg_championship_player_60914","price":20},{"id":"mpg_championship_player_199584","price":1},{"id":"mpg_championship_player_212721","price":1},{"id":"mpg_championship_player_85971","price":74},{"id":"mpg_championship_player_101178","price":42},{"id":"mpg_championship_player_45034","price":17},{"id":"mpg_championship_player_433154","price":15},{"id":"mpg_championship_player_180135","price":1},{"id":"mpg_championship_player_168580","price":1},{"id":"mpg_championship_player_118748","price":85},{"id":"mpg_championship_player_78830","price":80},{"id":"mpg_championship_player_195899","price":26},{"id":"mpg_championship_player_80146","price":10}]}