Guest User

Untitled

a guest
Feb 5th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. ManifoldApi api = new("<api key>");
  2. List<string> bots = new () {
  3. "pos",
  4. "v",
  5. "acc",
  6. "jerk",
  7. "snap",
  8. "ArbitrageBot",
  9. "MarketManagerBot",
  10. "Botlab",
  11. "JuniorBot",
  12. "ManifoldDream",
  13. "ManifoldBugs",
  14. "ACXBot",
  15. "JamesBot",
  16. "RyanBot",
  17. "trainbot",
  18. "runebot",
  19. "LiquidityBonusBot",
  20. "538",
  21. "FairlyRandom",
  22. "Anatolii",
  23. "JeremyK",
  24. "Botmageddon",
  25. "SmartBot",
  26. "ShifraGazsi",
  27. "Bot",
  28. "Catnee"
  29. };
  30. Market market = await api.CreateMarket(
  31. 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.",
  32. 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.",
  33. closeTime: DateTime.UtcNow.AddHours(24),
  34. initialProb: 50
  35. );
  36. string? beforeValue = null;
  37. HashSet<string> usersTraded = new();
  38. while (true)
  39. {
  40. await Task.Delay(1000);
  41. List<Bet> trades = await ManifoldApi.GetBets(contractId: market.Id, before: beforeValue);
  42. if (trades.Count == 0)
  43. continue;
  44. beforeValue = trades[^1].Id;
  45.  
  46. List<string> newUsersTraded = trades.Select(t => t.UserId).Where(u => !usersTraded.Contains(u)).ToList();
  47. if (newUsersTraded.Count == 0)
  48. continue;
  49.  
  50. usersTraded.UnionWith(newUsersTraded);
  51. for (int i = 0; i < newUsersTraded.Count; i++)
  52. {
  53. string userId = newUsersTraded[i];
  54. User user = await api.GetUserInformation(userId);
  55. if (bots.Contains(user.Username))
  56. continue;
  57.  
  58. await api.PlaceBet(5, "NO", market.Id);
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment