Guest User

Untitled

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