This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a map to store unique tickers for an account | |
var account1 = new Map(); | |
var account2 = new Map(); | |
var account3 = new Map(); | |
var account4 = new Map(); | |
var account5 = new Map(); | |
var account6 = new Map(); | |
function generateTrade(account, stockQuant, stockPrice, action) { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get transactions from customer transaction history and sort them by date oldest to newest | |
var lastTransactionRow = SpreadsheetApp.getActive().getRangeByName('lastTransactionRow').getValue(); | |
var transactions = SpreadsheetApp.getActive().getSheetByName("History").getRange("B3:J" + (lastTransactionRow - 1)).getValues(); | |
transactions = transactions.sort(compareNthElements(4, basicComparator)); | |
//specify which column contains the account name (arrays are 0 based) | |
var accountCol = 2; | |
//tickers may be duplicated across accounts; each key in a Map object must be unique; therefore each account needs it's own map | |
var account1 = new Map(); | |
var account2 = new Map(); | |
var account3 = new Map(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//***GLOBALS***// | |
var ss = SpreadsheetApp.getActive(); | |
var portfolioSheet = ss.getSheetByName("master"); //replace master with name of the tab that has your portfolio data | |
var columnToCheck = portfolioSheet.getRange("A:A").getValues(); | |
// Get the last row based on the data range of a single column. | |
var tickerCount = getLastRowSpecial(columnToCheck); | |
/************************************************************************ | |
* | |
* Gets the last row number based on a selected column range values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//***GLOBALS***// | |
var ss = SpreadsheetApp.getActive(); | |
var portfolioSheet = ss.getSheetByName("master"); //replace master with name of the tab that has your portfolio data | |
var columnToCheck = portfolioSheet.getRange("A:A").getValues(); | |
// Get the last row based on the data range of a single column. | |
var lastRow = getLastRowSpecial(columnToCheck); | |
/** | |
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population") | |
* @param url URL of your JSON data as string |