aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api.h5
-rw-r--r--portfolio.h19
-rw-r--r--string-tick.h7
3 files changed, 28 insertions, 3 deletions
diff --git a/api.h b/api.h
index ed38db54664a..60b39a8b3dcd 100644
--- a/api.h
+++ b/api.h
@@ -310,6 +310,11 @@ Info* api_get_check_info(const char* symbol);
*/
Info* api_get_info(const char* symbol);
+/**
+ * Fills an Info_Array with check api data and portfolio data. Primarily used for "check" command.
+ * @param portfolio_data Info_Array
+ * @param pString portfolio data
+ */
void api_info_array_populate_data(Info_Array* portfolio_data, String* pString);
/**
diff --git a/portfolio.h b/portfolio.h
index 53479d078ad1..83f366b1b31e 100644
--- a/portfolio.h
+++ b/portfolio.h
@@ -33,8 +33,27 @@ extern char* portfolio_file_path;
*/
void portfolio_file_path_init(void);
+/**
+ * Returns the portfolio in a String. If it is encrypted, it will be decrypted using password
+ * input through ncurses.
+ * @param password_ref if decryption is necessary, will reference a char* of the password
+ * @return Plaintext portfolio in a String or NULL if error/wrong password
+ */
String* portfolio_ncurses_get_plaintext_string(char** password_ref);
+/**
+ * If portfolio file exists, decrypts it if necessary and calls portfolio_string_modify to change
+ * the value of an element in the portfolio. If it doesn't exist, creates a new file.
+ *
+ * Afterwards, re-encrypts the portfolio and writes it to the user's home folder.
+ *
+ * @param symbol string containing the symbol of the security to add or name of the cryptocurrency
+ * @param quantity_shares the number of shares to modify the portfolio by (must be >0 for add/rm,
+ * or >=0 for set)
+ * @param usd_spent the amount of USD to modify the portfolio by (must be >0 for add/rm, or >=0
+ * for set)
+ * @param mod_option SET, REMOVE, or ADD
+ */
void portfolio_modify_write(const char* symbol, double quantity_shares, double usd_spent,
int mod_option);
diff --git a/string-tick.h b/string-tick.h
index f18347e53eec..23cc190a41bf 100644
--- a/string-tick.h
+++ b/string-tick.h
@@ -68,14 +68,15 @@ char* strip_char(char* string, char c);
char* strip_tags(char* string);
/**
- * Returns the contents of a file in a String
+ * Returns the contents of a file in a String. Will return NULL if the file doesn't exist, if the
+ * file cannot be opened, or if there is an issue reading the file.
* @param file_name path to file
- * @return String*
+ * @return String* or NULL
*/
String* file_get_string(char* file_name);
/**
- * Writes a String to a file
+ * Writes a String to a file. Will return on error opening file.
* @param pString the String to overwrite with
*/
void string_write_file(String* pString, char* file_name);