Custom Entities and how to get setDisplayOptions types

Since we already wrote about how to make custom entity(data model) we will want to configure base fields we are adding, first thing you will want is to configure what fields are used for view and form part. So to know what you can choose for  ->setDisplayOptions('view' or  ->setDisplayOptions('form' part of your code you need to get a list of 
field widget/formatter plugin IDs, you can obtain that with some code, go to yoursite.com/devel/php and in box write

$widget_types = \Drupal::service('plugin.manager.field.widget')->getDefinitions();
$plugin_ids = array_keys($widget_types);

print_r($plugin_ids);

you will get a list of widgets ids you can use and set for FORM part of settings and use in ->setDisplayOptions('form'

For a view ->setDisplayOptions('view' you will need a different list, as we are fetching now formatters, so we access service in charge of that part of drupal.

$widget_types = \Drupal::service('plugin.manager.field.formatter')->getDefinitions();
$plugin_ids = array_keys($widget_types);

print_r($plugin_ids);

and with those 2 lists we now know what we can choose from. So lets set one field with this knowledge.

    $fields['ticker'] = BaseFieldDefinition::create('string')
      ->setLabel(t('ticker'))
      ->setDescription(t('Ticker of the Currency'))
      ->setDisplayOptions('form', array(
        'type' => 'string_textfield',
        'settings' => array(
          'display_label' => TRUE,
        ),
      ))
     ->setDisplayOptions('view', array(
        'label' => 'hidden',
        'type' => 'string',
      ))
      ->setDisplayConfigurable('form', TRUE)
      ->setRequired(TRUE);

Check this post to get some info on how to make custom entity in the first place
https://www.drupaldump.com/data-modeling-drupal-custom-content-entity