Pulling product description information with API? - amazon

Is there a way to pull the product description area of a listing directly with the API? I'm able to get the title and bulletpoint information fine within the product API. But the product description area seems to be missing.
<Product>
<Identifiers>
<MarketplaceASIN>
<MarketplaceId>Removed</MarketplaceId>
<ASIN>B00BAWXD88</ASIN>
</MarketplaceASIN>
</Identifiers>
<AttributeSets>
<ns2:ItemAttributes xml:lang="en-US">
<ns2:Binding>Video Game</ns2:Binding>
<ns2:Brand>Xseed</ns2:Brand>
<ns2:Creator Role="Production Company">Xseed Jks Inc</ns2:Creator>
<ns2:Edition>Standard</ns2:Edition>
<ns2:ESRBAgeRating>Everyone 10+</ns2:ESRBAgeRating>
<ns2:Feature>The popular spinoff from the 'Harvest Moon' series returns, combining farming and family life with monster battling and taming, with an all-new story that's accessible to new players and series veterans alike</ns2:Feature>
<ns2:Feature>Whether it be governing as the prince, tilling the fields, interacting with townsfolk, or heading to a dungeon to take on dangerous foes, the diverse amount of activities ensure that each day is a new adventure</ns2:Feature>
<ns2:Feature>Use swords, spears, staffs and other weapons and magic to personalize your battle tactics as formidable monsters await in trap-laden dungeons; invite the townsfolk along, develop friendships with certain monsters and grow stronger together</ns2:Feature>
<ns2:Feature>The main character can be male or female, and either gender can woo marriage candidates from among the townsfolk; communication and gift giving will be key to romance, potentially resulting in marriage and perhaps an adorable child together</ns2:Feature>
<ns2:Feature>The popular spinoff from the 'Harvest Moon' series returns, combining farming and family life with monster battling and taming, with an all-new story that's accessible to new players and series veterans alike</ns2:Feature>
<ns2:Feature>Whether it be governing as the prince, tilling the fields, interacting with townsfolk, or heading to a dungeon to take on dangerous foes, the diverse amount of activities ensure that each day is a new adventure</ns2:Feature>
<ns2:Feature>Use swords, spears, staffs and other weapons and magic to personalize your battle tactics as formidable monsters await in trap-laden dungeons; invite the townsfolk along, develop friendships with certain monsters and grow stronger together</ns2:Feature>
<ns2:Feature>The main character can be male or female, and either gender can woo marriage candidates from among the townsfolk; communication and gift giving will be key to romance, potentially resulting in marriage and perhaps an adorable child together</ns2:Feature>
<ns2:Genre>role-playing-game-genre</ns2:Genre>
<ns2:HardwarePlatform>nintendo_3ds</ns2:HardwarePlatform>
<ns2:ItemDimensions>
<ns2:Height Units="inches">5.40</ns2:Height>
<ns2:Length Units="inches">0.40</ns2:Length>
<ns2:Width Units="inches">4.90</ns2:Width>
<ns2:Weight Units="pounds">0.10</ns2:Weight>
</ns2:ItemDimensions>
<ns2:IsAdultProduct>false</ns2:IsAdultProduct>
<ns2:IsEligibleForTradeIn>true</ns2:IsEligibleForTradeIn>
<ns2:Label>Xseed</ns2:Label>
<ns2:Languages>
<ns2:Language>
<ns2:Name>english</ns2:Name>
<ns2:Type>Published</ns2:Type>
</ns2:Language>
<ns2:Language>
<ns2:Name>english</ns2:Name>
<ns2:Type>Original Language</ns2:Type>
</ns2:Language>
<ns2:Language>
<ns2:Name>english</ns2:Name>
<ns2:Type>Unknown</ns2:Type>
</ns2:Language>
</ns2:Languages>
<ns2:ListPrice>
<ns2:Amount>29.99</ns2:Amount>
<ns2:CurrencyCode>USD</ns2:CurrencyCode>
</ns2:ListPrice>
<ns2:Manufacturer>Xseed</ns2:Manufacturer>
<ns2:ManufacturerMinimumAge Units="months">12.00</ns2:ManufacturerMinimumAge>
<ns2:Model>81356</ns2:Model>
<ns2:NumberOfItems>1</ns2:NumberOfItems>
<ns2:OperatingSystem>nintendo_3ds</ns2:OperatingSystem>
<ns2:PackageDimensions>
<ns2:Height Units="inches">0.70</ns2:Height>
<ns2:Length Units="inches">5.40</ns2:Length>
<ns2:Width Units="inches">4.90</ns2:Width>
<ns2:Weight Units="pounds">0.15</ns2:Weight>
</ns2:PackageDimensions>
<ns2:PackageQuantity>1</ns2:PackageQuantity>
<ns2:PartNumber>81356</ns2:PartNumber>
<ns2:PegiRating>ages_7_and_over</ns2:PegiRating>
<ns2:Platform>Nintendo 3DS</ns2:Platform>
<ns2:ProductGroup>Video Games</ns2:ProductGroup>
<ns2:ProductTypeName>CONSOLE_VIDEO_GAMES</ns2:ProductTypeName>
<ns2:PublicationDate>2013-10-02</ns2:PublicationDate>
<ns2:Publisher>Xseed</ns2:Publisher>
<ns2:ReleaseDate>2013-10-01</ns2:ReleaseDate>
<ns2:SmallImage>
<ns2:URL>http://ecx.images-amazon.com/images/I/617jaCu3H5L._SL75_.jpg</ns2:URL>
<ns2:Height Units="pixels">65</ns2:Height>
<ns2:Width Units="pixels">75</ns2:Width>
</ns2:SmallImage>
<ns2:Studio>Xseed</ns2:Studio>
<ns2:Title>Rune Factory 4 - Nintendo 3DS</ns2:Title>
</ns2:ItemAttributes>
</AttributeSets>
<Relationships/>
<SalesRankings>
<SalesRank>
<ProductCategoryId>video_games_display_on_website</ProductCategoryId>
<Rank>467</Rank>
</SalesRank>
<SalesRank>
<ProductCategoryId>4924892011</ProductCategoryId>
<Rank>22</Rank>
</SalesRank>
</SalesRankings>
</Product>

Amazon is providing _GET_MERCHANT_LISTINGS_DATA_, based on that we can get active product listing from amazon.
Report provide information like sku,title,description,ASIN..etc.. and It will give you information marketplace wise
You can get more info about report from below link.
http://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html
This may help you.

Related

Use One TradingView Strategy for Multiple Coins connected to Bot

I'm a newbie for TradingView and have been learning a lot. I'm developing a strategy with backtesting using pine-script language however what confusing me, is how to use the same strategy for multiple coins.
The strategy is mainly developed for Binance Futures trading not sure if possible to apply it to other Exchangers.
So I wanna setup alerting system for multiple coins to be connected to 3comma Bot or Finandy to execute a trade based on the setup parameter.
My questions are.
If I wanna use certain candle types like Hiken Ashi should that be included in the code or just select it in the chart and it will be read by the strategy automatically?
Should I include the coins in the script or I should select them one by one in the chart and then setup an alert per coin?
Should I create one alert per one coin per chart or I should have multiple charts per each coin to setup an alert?
Should the timeframe also be defined in the code or the chart can do the job?
Sorry for many questions, I'm trying to understand the process well.
For multiple coins, the easiest way is to attach your strategy to each and every coin on Tradingview you want to trade with. This way you can backtest each on their respective chart.
If you create a strategy for say BINANCE:BTCUSDT and think of using this strategy on different exchange, you can do it, but first I suggest test it on BINANCE:BTCPERP and see for yourself how the same strategy can show a wildly different result (even though BTCUSDT and BTCPERP should be moving the same).
For a complex solution you can create a single script that uses multiple securities, but you won't be able to backtest that with simple approach, you would have to write your own gain/loss calculator, and you are not there yet.
I was going down the same road, my suggestions are:
create an input for the coin you want to trade (that will go into an input variable)
abstract the alert message off of the strategy.entry() command, that is, construct the alert message in a way you can replace values with variables in it (like the above selected coin)
3Commas needs a Bot ID to start/stop a bot, abstract that off as well, and you will have a good boilerplate code you can reuse many times
as a good practice (stolen from Kubernetes) besides the human readable name, I give a 5 letter identifier to every one of my bots, for easy recognition
A few examples. The below will create a selector for a coin and the Bot ID that is used to trade that coin. The names like 'BIN:GMTPERP - osakr' are entirely my making, they act as a Key (for a key/value pair):
symbol_choser = input.string(title='Ticker symbol', defval='BTC-PERP - aktqw', options=[FTX_Multi, 'FTX:MOVE Single - pdikr', 'BIN:GMTPERP - osakr', 'BIN:GMTPERP - rkwif', 'BTC-PERP - aktqw', 'BTC-PERP - ikrtl', 'BTC-PERP - cbdwe', 'BTC-PERP', 'BAL-PERP', 'RUNE-PERP', 'Paper Multi - fjeur', 'Paper Single - ruafh'], group = 'Bot settings')
exchange_symbol = switch symbol_choser // if you use Single Pair bots on 3Commas, the Value should be an empty string
'BIN:GMTPERP - osakr' => 'USDT_GMTUSDT'
'BTC-PERP - cbdwe' => 'USD_BTC-PERP'
'Paper Multi - fjeur' => 'USDT_ADADOWN'
bot_id = switch symbol_choser
'BIN:GMTPERP - osakr' => '8941983'
'BTC-PERP - cbdwe' => '8669136'
'Paper Multi - fjeur' => '8246237'
And now you can combine the above parts into two Alerts, for starting/stopping the bot:
alertMessage_Enter = '{"message_type": "bot", "bot_id": ' + bot_id + ', "email_token": "12345678-4321-abcd-xyzq-132435465768", "delay_seconds": 0, "pair": "' + exchange_symbol + '"}'
alertMessage_Exit = '{"action": "close_at_market_price", "message_type": "bot", "bot_id": ' + bot_id + ', "email_token": "12345678-4321-abcd-xyzq-132435465768", "delay_seconds": 0, "pair": "' + exchange_symbol + '"}'
exchange_symbol is the proper exchange symbol you need to provide to your bot, you can get help on the 3Commas' bot page (they have pre-crafted the HTTP requests you need to use for certain actions).
bot_id is the ID of your Bot, that is straightforward.
The above solution does not handle Single coin bots, their trigger message has a different structure.
Whenever you can, use Multi coin bots as they can act as a Single bot with two exception:
if you have a long spanning strategy and when you start a bot, you should be already in a trade, you can manually start a Single bot, but you cannot start a Multi coin bot (as there is no way to provide the coin info on which to start the trade)
if you are trading a derivative like FTX's MOVE contracts and your script is attached to the underlying BTC Futures. MOVE contracts changes name every day (the date is in their name, like: BTC-MOVE-0523) so you would need delete an alert, update and reapply the alert every day, etc. Instead, if your script is on the BTC-PERP then you can use a Single coin bot which does not expect a coin name in the alert message so it will start/stop the Bot on whatever coin it is connected to, then you need to change the coin name every day only in the Bot settings and never touch the Alert.
To summarize on your questions:
Do not include chart type in code (that is not even an embeddable data), just apply your code to whatever chart you want to use. Hint: never use Heikin-Ashi for trading. You can, but you will pay for it dearly (everyone tries, even against warnings, no worries)
Set up them one-by-one, so you can backtest them
No, set the timeframe on the chart. Later, when you will be more experienced you will be able to abstract the current timeframe (whatever it is) away and write code that is timeframe-agnostic. But that's hard and make your code less readable.

(Mongoose) Get all items in database that have any fields (or all fields) that contain or are similar to search text

I have some data on books and want to perform a search on these JSON objects:
// all descriptions are from wiki, see footnotes.
{
title: "In Search of Lost Time",
author: "Marcel Proust",
description: "In Search of Lost Time follows the narrator's recollections of childhood and experiences into adulthood in the late 19th century and early 20th century high society France, while reflecting on the loss of time and lack of meaning in the world.", // from wikipedia, see footnotes
published: "1913" // date
}
{
title: "Ulysses",
author: "James Joyce",
description: "Ulysses chronicles the appointments and encounters of the itinerant Leopold Bloom in Dublin in the course of an ordinary day, 16 June 1904.[4][5] Ulysses is the Latinised name of Odysseus, the hero of Homer's epic poem the Odyssey, and the novel establishes a series of parallels between the poem and the novel, with structural correspondences between the characters and experiences of Bloom and Odysseus, Molly Bloom and Penelope, and Stephen Dedalus and Telemachus, in addition to events and themes of the early 20th-century context of modernism, Dublin, and Ireland's relationship to Britain.", // from wikipedia, see footnotes
published: "1922" // date
}
Let's say my search text is this: "marcel proust ullyses". I would like both items to be returned from MongoDB.
If, say I were to write "search of time recollections", I would like In Search of Lost time to be the only one that shows up, because in the description it has the word recollections and the title contains the words Search of (lost) Time.
If I had 2 items in the database of "In Search of Lost Time", but one was published 1913 and another was published 1927 and I searched for "In Search of Lost Time 1927" I would expect the latter to be returned. Is this possible?
Thanks

multiple many to many relationships with bookshelf.js

I'm trying to determine the best way to represent the following using Bookshelf.js:
I have an Appointment model and each Appointment has:
1 or more Pet(s)
1 or more Service(s)
I'm able to easily represent this using many to many relationships in Bookshelf, which results in three tables: appointment, appointment_pet, and appointment_service.
I now have a new requirement that requires the ability to specify the Service(s) that are associated with each Pet on a per-appointment basis so that the services associated with a particular pet may be easily retrieved. For example:
Appointment 1
Has 1 Pet
Has 2 Services (walk, water plants)
Pet is associated with walk service only.
Getting all services for the Pet associated with Appointment 1 would return walk.
Is there an optimal way to represent this scenario using Bookshelf?
I'm considering that any Pet is always associated with a Service. In that case, I would structure it like:
As in, the Service model works as the bridge between an Appointment and the Pets. The Service can have a pet (e.g. when it's walk) or not (e.g. when it's water plants). The BookshelfJS model would look like:
var Appointment = bookshelf.Model.extend({
services: function () {
return this.hasMany('Service');
},
pets: function () {
return this.hasMany('Pet').through('Service');
},
});
A possible issue is that you'll end up with many different Services of the same type, but for different combinations of Appointment and Pet. This isn't problematic, if there're not many attributes on Service. For example, if Service has only a type attribute.
If you want to add more attributes to Service, say a price, time_duration, etc., you could extract it in its own table, as:
Then the Service table will have each type of service with its attributes (e.g. price, time_duration, ...). The code would look like:
var Appointment = bookshelf.Model.extend({
services: function () {
return this.hasMany('Service').through('AppointmentService');
},
pets: function () {
return this.hasMany('Pet').through('AppointmentService');
},
});
I would suggest going with the simpler case, and changing that if needed afterwards. You also might need to use the withPivot method to get the values from the relationship tables.

cakePHP and authorization for CRUD operations

I have a cakephp 1.3 application and I have run into a 'data leak' security hole. I am looking for the best solution using cake and not just something that will work. The application is a grade tracking system that lets teachers enter grades and students can retrieve their grades. Everything is working as expected but when I started to audit security I found that the basic CRUD operations have leaks. Meaning that student X can see student Y's grades. Students should only see their own grades. I will limit this questions to the read operation.
Using cake, I have a grade_controller.php file with this view function:
function view($id = null) {
// Extra, not related code removed
$this->set('grade', $this->grade->read(null, $id));
}
And
http://localhost/grade/view/5
Shows the grade for student $id=5. That's great. But if student #5 manipulates the URL and changes it to a 6, person #6's grades are shown. The classic data leak security hole.
I had two thoughts on the best way to resolve this. 1) I can add checks to every CRUD operations called in the controller. Or 2) add code to the model (for example using beforeFind()) to check if person X has access to that data element.
Option #1 seems like it is time consuming and error prone.
Option #2 seem like the best way to go. But, it required calling find() before some operations. The read() example above never executes beforeFind() and there is no beforeRead() callback.
Suggestions?
Instead of having a generic read() in your controller, you should move ALL finds, queries..etc into the respective model.
Then, go through each model and add any type of security checks you need on any finds that need to be restricted. 1) it will be much more DRY coding, and 2) you'll better be able to manage security risks like this since you know where all your queries are held.
For your example, I would create a getGrade($id) method in my Grade model and check the student_id field (or whatever) against your Auth user id CakeSession::read("Auth.User.id");
You could also build some generic method(s) similar to is_owner() to re-use the same logic throughout multiple methods.
If CakePHP supports isAuthorized, here's something you could do:
Create a column, that has the types of users (eg. 'student', 'teacher', ...)
Now, it the type of User is 'student', you can limit their access, to view only their data. An example of isAuthorized is as follows. I am allowing the student to edit only their profile information. You can extend the concept.
if ((($role['User']['role'] & $this->user_type['student']) == $this->user_type['student']) {
if (in_array($this->action, array('view')) == true) {
$id = $this->params->pass[0];
if ($id == $user_id) {
return (true);
}
}
}
}

Using a postcode range for shipping (expresso-store)

We're building a online-store/site for a winery, and they have a matrix/table of shipping costs to different regions (in Australia).
In Exp-resso Store 1.6.0, is there anyway of setting up a post-code for a specific shipping cost?
i.e. postcode= 2000-2249, 2555-2574 = $10 + $1/kg. 1250-1263 = $12 +$1.1/kg
Additional info: The deliveries are technically through AusPost, but using their "Wine Delivery Service" which doesn't match their normal parcel delivery stuff, so we can't use the AusPost plugin/API :(
There's no way to do this from the control panel. However, you can easily write your own shipping calculator using PHP.
An example of a simple custom shipping plugin is here:
https://gist.github.com/2176462

Resources