Advertisement
Guest User

Untitled

a guest
Apr 1st, 2024
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Anon Auto Buy Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-04-01
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://boards.4chan.org/yse.html
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=4chan.org
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. const protip = document.getElementById('js-protip')
  13. window.alert = a => protip.innerText = a
  14. let order_count = 0
  15. const order_counter = document.createElement('span')
  16. protip.insertAdjacentElement('afterend', order_counter)
  17. const auto_btn = document.createElement('button')
  18. let order_btn = () => document.getElementById('js-order-btn')
  19. order_btn().parentElement.appendChild(auto_btn)
  20. auto_btn.innerText = 'Auto'
  21. const refresh_btn = () => document.getElementById('js-refresh')
  22. const buy_btn = () => document.getElementById('js-buy-cb')
  23. const sell_btn = () => document.getElementById('js-sell-cb')
  24. const amount_btn = () => document.getElementById('js-amount')
  25. const price_btn = () => document.getElementById('js-cur-price')
  26. let interval
  27. function run() {
  28. function stop_fn() {
  29. clearInterval(interval)
  30. auto_btn.onclick = run
  31. auto_btn.innerText = 'Auto'
  32. }
  33. auto_btn.onclick = stop_fn
  34. auto_btn.innerText = 'Stop'
  35. const buy = buy_btn().checked
  36. const sell = sell_btn().checked
  37. const amount = amount_btn().value
  38. const known_price = price_btn().innerText
  39. function dump_it() {
  40. refresh_btn().click()
  41. if (known_price === price_btn().innerText) {
  42. amount_btn().value = amount
  43. if (buy) buy_btn().click()
  44. if (sell) sell_btn().click()
  45. order_btn().click()
  46. setTimeout(() => {
  47. if (buy) buy_btn().click()
  48. if (sell) sell_btn().click()
  49. amount_btn().value = amount
  50. }, 1000)
  51. if (protip.innerText === 'Your account balance is too low') stop_fn()
  52. else {
  53. order_count++
  54. order_counter.innerText = order_count + ' orders filled'
  55. }
  56. } else {
  57. alert('Stopped due to price change')
  58. stop_fn()
  59. }
  60. }
  61. dump_it()
  62. interval = setInterval(dump_it, 10010)
  63. }
  64. auto_btn.onclick = run
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement