alleyway / add-tradingview-alerts-tool

Automated entry of TradingView alerts for bot trading tools such as 3Commas, Alertatron, CryptoHopper, etc.
MIT License
625 stars 140 forks source link

[RE] invite-only "manage permissions" #61

Open marianolatorre opened 3 years ago

marianolatorre commented 3 years ago

Hi guys, apologies for raising as an issue here.

I use extensively the add tradingview alerts tool, I really love it!!!

I was wondering if any of you was aware of any similar tool but to add permissions for invite-only scripts?

It'd be great if you could consider adding it. My first impression is that it should be at least way more simple than adding alerts as there's only a few fields and not many edge cases, and given that you have already the auth and chromium platform sorted out it would be a great addition!

I know MANY existing users of adding alerts would have a strong interest in being able to add permissions too.

Thanks!

marianolatorre commented 3 years ago

Good news, I managed to implement this functionality

I'm not an expert in TS or JS, but I modified locally the JS files so it does exactly what I need. I think it's in a POC state but definitely can be added as an extra feature here if you guys are up for it.

I think hundreds of users (at least) have been begging TV to support better management of invite only scripts so this could be big value as TV are not planning much in that area AFIK

mlake commented 3 years ago

could be interesting...what would we have to call this project then? Maybe "add-tradingview-alerts-and-sync-tradingview-invites-tool"? has a nice ring to it...

marianolatorre commented 3 years ago

That's a very techie response :) you need a bit of business mindset too sometimes!

_Tradingview manager pro, supporting all repetitive tasks required for signal managers including:

Anyways, here are the changes in case any one else can benefit from them...appreciate that maybe this tool would be best to keep solving a single problem, maybe a separated one based on this (reusing many of the problems you already solved, auth, setup of chromium, etc) The changes below are not even close to production ready but at least it will save the time to figure all the xpaths and it does work.

tv-page-actions.js changes: `export const manageAccess = async (page) => { const manageAccessButton = await fetchFirstXPath(page, '//button[@data-name=\'manage-access\']'); log.trace("clicking manage access button"); manageAccessButton.click();

}; export const addUser = async (page, username) => { //click manage await waitForTimeout(.5); const myUserInput = await fetchFirstXPath(page, '//input[@name=\'manage-access-user-search\']'); log.trace("typing user"); await myUserInput.type(${username}); await waitForTimeout(.5);

try {
    //type user
    const userResult = await fetchFirstXPath(page, '(//div[contains(text(),\''+`${username}`+'\')])[1]', 1000);
    userResult.click();
    await waitForTimeout(1000);

    //uncheck box
    const checkbox = await fetchFirstXPath(page, '//input[@class=\'input-24iGIobO\' and @value=\'on\']', 10)
    const isChecked = await page.evaluate(element => element.checked, checkbox);
    if (isChecked){
        checkbox.click();
        await waitForTimeout(500);
    }
    //empty date field
    const dateInput = await fetchFirstXPath(page, '//input[@class=\'input-3bEGcMc9 with-end-slot-S5RrC8PC\']')
    clickInputAndDelete(page, dateInput)
    await waitForTimeout(500); 
    // type date
    await page.evaluate((el) => el.value = "2021-07-01", dateInput);
    // await dateInput.type("2021-07-01");
    await waitForTimeout(500);
    //click submit
    const submitButton = await fetchFirstXPath(page, '//button[@class=\'button-1iktpaT1 size-m-2G7L7Qat intent-primary-1-IOYcbg appearance-default-dMjF_2Hu\']');
    submitButton.click();
    await waitForTimeout(500);
}
catch (e) {
    log.warn("user not found: ", username);
    const dismissButton = await fetchFirstXPath(page, '//span[@class=\'close-2sL5JydP\']');
    dismissButton.click();
    await waitForTimeout(500);
}    

}`

changes to 'add-alerts.js' const permissionRows = await readFilePromise(config.files.input); for (const row of permissionRows) { await manageAccess(page); await addUser(page,row.username,config.permissions.date); } await browser.close();

The YAML file will require this extra field for the expiry date of the permission: permissions: date: 2021-07-01

and the txt file will only use one column with each username that needs to be added: username, francisb01 mgrzegorzak ua87 matej-b legalDove56784

mlake commented 3 years ago

TradingView...Manager...Pro.. 🤔 I LOVE IT! way better than my name...

How much do you think people would pay for it?

FYI..here's a little teaser of something to come...

image

marianolatorre commented 3 years ago

That looks spectacular 😮

People requiring to add hundreds of alerts fit into this profile:

Is not in my best interest that you charge me more, of course, but I'm personally willing to pay from $50 to $100 a month for something that takes away ALL this hassle so I can focus on what I do which is building great strategies and selling them. As long as TV don't decide to release these features officially you got yourself a great opportunity to monetise it (maybe for a year?).

By the way, even though my code above is editing the value of the expiry date HTML input, the form seems to be reset back to its original value right before being submitted which made all my effort a waste of time :( I tried triggering manually some events like onType, onChange, onKeyUp, down, etc to try to find which event is updating their data model so it doesn't get reset back to default value but I ended up giving up. I'm sure it's doable but ran out of spare time to keep hacking around now.

I checked what their javascripts are doing, and its really complicated, I suspect they use vendor.js to protect from UI automation...who knows.

mlake commented 3 years ago

Hours spent chasing a solution and coming up empty-handed? I can relate..

took a brief look at TV's user management of private indicators...I think it's doable for automation, but frankly been heads-down trying to hammer out the frontend (any day now...right? 🙄 ). super strange there's no api to manage that. can imagine what a hassle that is for creators...

Thanks for weighing in - especially on pricing - those numbers are in-line with what I was thinking.

Perhaps I'll circle back with you and we could collaborate on a zoom call or something..

marianolatorre commented 3 years ago

Absolutely! Collaboration works for me

maybe not your cup of tea, but this is what I spend most of the time on these days https://www.youtube.com/channel/UCrqilwm_w0Jww188AyxBq7w

rakesh1988 commented 1 year ago

@mlake hijacking this topic to ask your opinion. i have implemented this feature and would like to know if you are open to accept an MR for the same. if you have a business idea and you think this can be problematic, i will refrain from raising a MR. Thanks

chadidbarnero commented 1 year ago

Hi, there are tools for this. Try:

https://www.tradingintegration.com/ https://algoautomation.io/

paradyo commented 11 months ago

Also, there are other unofficial solutions for this. Try:

https://rapidapi.com/financetrading/api/tradingview-rest