Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (true)
- {
- ManifoldApi api = new("<api key>");
- List<string> bots = new() {
- "pos",
- "v",
- "acc",
- "jerk",
- "snap",
- "ArbitrageBot",
- "MarketManagerBot",
- "Botlab",
- "JuniorBot",
- "ManifoldDream",
- "ManifoldBugs",
- "ACXBot",
- "JamesBot",
- "RyanBot",
- "trainbot",
- "runebot",
- "LiquidityBonusBot",
- "538",
- "FairlyRandom",
- "Anatolii",
- "JeremyK",
- "Botmageddon",
- "SmartBot",
- "ShifraGazsi",
- "Bot",
- "Catnee"
- };
- Market market = await api.CreateMarket(
- question: "Resolves YES. I will buy 5 mana of NO every time a new user (to this market, user must not be a bot) places a trade.",
- description: "I will not bet on this market apart from buying 5 mana of NO every time a new user (to this market, user must not be a bot) places a trade.",
- closeTime: DateTime.UtcNow.AddHours(24),
- initialProb: 50
- );
- string? beforeValue = null;
- HashSet<string> usersTraded = new();
- DateTime closeTime = DateTimeOffset.FromUnixTimeSeconds(market.CloseTime).DateTime;
- while (true)
- {
- await Task.Delay(1000);
- if (DateTime.UtcNow > closeTime)
- break;
- List<Bet> trades = await ManifoldApi.GetBets(contractId: market.Id, before: beforeValue);
- if (trades.Count == 0)
- continue;
- beforeValue = trades[^1].Id;
- List<string> newUsersTraded = trades.Select(t => t.UserId).Where(u => !usersTraded.Contains(u)).ToList();
- if (newUsersTraded.Count == 0)
- continue;
- usersTraded.UnionWith(newUsersTraded);
- for (int i = 0; i < newUsersTraded.Count; i++)
- {
- string userId = newUsersTraded[i];
- User user = await api.GetUserInformation(userId);
- if (bots.Contains(user.Username))
- continue;
- await api.PlaceBet(5, "NO", market.Id);
- }
- }
- await api.ResolveBet(market.Id, "YES");
- }
Advertisement
Add Comment
Please, Sign In to add comment